【发布时间】:2021-02-03 07:33:20
【问题描述】:
我有一个像这样的 vue-router 的动态路由,
import customReportWrapper from './customReportWrapper.vue';
let router = new Router({
mode: 'history',
routes: [{
path: '/insights/custom-reports/:id',
name: 'custom-reports',
page: 'insights',
component: customReportWrapper
}]
})
每次有人导航到这条路线时,都会使用 CustomReportWrapper.vue 进行渲染。但是它们每个导航都使用相同的 Component 实例,如 vue-router docs here.中所述
我想覆盖这个行为,这样每一个新的导航都会创建一个新的 Vue 组件实例。如果不直接支持这一点,任何解决方法也会有所帮助。
【问题讨论】:
标签: vue.js vue-router dynamic-routing