Add hotReload in context

This commit is contained in:
Sebastien Chopin 2017-05-31 13:21:24 +02:00
parent e967191167
commit f089bcfff6
2 changed files with 3 additions and 2 deletions

View File

@ -270,7 +270,7 @@ function addHotReload ($component, depth) {
<%= (loading ? 'this.$loading.finish && this.$loading.finish()' : '') %> <%= (loading ? 'this.$loading.finish && this.$loading.finish()' : '') %>
router.push(path) router.push(path)
} }
let context = getContext({ route: router.currentRoute<%= (store ? ', store' : '') %>, isClient: true, next: next.bind(this), error: this.error }, app) let context = getContext({ route: router.currentRoute<%= (store ? ', store' : '') %>, isClient: true, hotReload: true, next: next.bind(this), error: this.error }, app)
<%= (loading ? 'this.$loading.start && this.$loading.start()' : '') %> <%= (loading ? 'this.$loading.start && this.$loading.start()' : '') %>
callMiddleware.call(this, Components, context) callMiddleware.call(this, Components, context)
.then(() => { .then(() => {

View File

@ -64,7 +64,8 @@ export function getContext (context, app) {
payload: context.payload, payload: context.payload,
error: context.error, error: context.error,
base: '<%= router.base %>', base: '<%= router.base %>',
env: <%= JSON.stringify(env) %> env: <%= JSON.stringify(env) %>,
hotReload: context.hotReload || false
} }
const next = context.next const next = context.next
ctx.params = ctx.route.params || {} ctx.params = ctx.route.params || {}