mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix plugins injectAs
This commit is contained in:
parent
cb524e0424
commit
59ece4978e
@ -89,7 +89,7 @@ function render (to, from, next) {
|
||||
nextCalled = true
|
||||
next(path)
|
||||
}
|
||||
let context = getContext({ to<%= (store ? ', store' : '') %>, isClient: true, next: _next.bind(this), error: this.error.bind(this) })
|
||||
let context = getContext({ to<%= (store ? ', store' : '') %>, isClient: true, next: _next.bind(this), error: this.error.bind(this) }, app)
|
||||
let Components = getMatchedComponents(to)
|
||||
this._context = context
|
||||
this._dateLastError = this.$options._nuxt.dateErr
|
||||
@ -274,7 +274,7 @@ function addHotReload ($component, depth) {
|
||||
<%= (loading ? 'this.$loading.finish && this.$loading.finish()' : '') %>
|
||||
router.push(path)
|
||||
}
|
||||
let context = getContext({ route: router.currentRoute<%= (store ? ', store' : '') %>, isClient: true, next: next.bind(this), error: this.error })
|
||||
let context = getContext({ route: router.currentRoute<%= (store ? ', store' : '') %>, isClient: true, next: next.bind(this), error: this.error }, app)
|
||||
<%= (loading ? 'this.$loading.start && this.$loading.start()' : '') %>
|
||||
callMiddleware.call(this, Components, context)
|
||||
.then(() => {
|
||||
|
@ -82,10 +82,10 @@ export default context => {
|
||||
// Add route to the context
|
||||
context.route = router.currentRoute
|
||||
// Update context
|
||||
ctx = getContext(context)
|
||||
ctx = getContext(context, app)
|
||||
// nuxtServerInit
|
||||
<% if (store) { %>
|
||||
let promise = (store._actions && store._actions.nuxtServerInit ? store.dispatch('nuxtServerInit', omit(getContext(context), 'redirect', 'error')) : null)
|
||||
let promise = (store._actions && store._actions.nuxtServerInit ? store.dispatch('nuxtServerInit', omit(getContext(context, app), 'redirect', 'error')) : null)
|
||||
if (!promise || (!(promise instanceof Promise) && (typeof promise.then !== 'function'))) promise = Promise.resolve()
|
||||
<% } else { %>
|
||||
let promise = Promise.resolve()
|
||||
|
@ -1,6 +1,4 @@
|
||||
'use strict'
|
||||
import { app } from './index'
|
||||
|
||||
const noopData = () => ({})
|
||||
|
||||
export function applyAsyncData (Component, asyncData = {}) {
|
||||
@ -38,7 +36,7 @@ export function flatMapComponents (route, fn) {
|
||||
}))
|
||||
}
|
||||
|
||||
export function getContext (context) {
|
||||
export function getContext (context, app) {
|
||||
let ctx = {
|
||||
isServer: !!context.isServer,
|
||||
isClient: !!context.isClient,
|
||||
|
Loading…
Reference in New Issue
Block a user