fix(vue-app): use mixin to provide this.$nuxt (#8068)

Co-authored-by: Clark Du <clark.duxin@gmail.com>
This commit is contained in:
Daniel Roe 2020-09-30 11:16:16 +01:00 committed by GitHub
parent 79440f3ce5
commit 8abdc177be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,6 +24,14 @@ if (!Vue.__nuxt__fetch__mixin__) {
}
<% } %>
Vue.mixin({
beforeCreate() {
if(Vue.prototype.<%= globals.nuxt %>) {
this.<%= globals.nuxt %> = Vue.prototype.<%= globals.nuxt %>
}
}
})
// Component: <NuxtLink>
Vue.component(NuxtLink.name, NuxtLink)
<% if (features.componentAliases) { %>Vue.component('NLink', NuxtLink)<% } %>