export default ({ app }, inject) => { // 注入 $hello(msg) in Vue, context and store. inject('hello', msg => console.log(`Hello ${msg}!`)) }
export default { plugins: ['~/plugins/hello.js'] }
this.$外掛名稱
$外掛名稱
export default { mounted() { this.$hello('我在前端被mounted了') }, asyncData({ app, $hello }) { $hello('我在後端被asyncData了') } }
asyncData(context) { context.$hello('我在後端被asyncData了') },
進階搜尋