diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index cbf9eeb7..25ff9d11 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -1,3 +1,6 @@ +import Vue from 'vue' +import router from '@/router/index' +import Layout from '@/views/layout/Layout' const tagsView = { state: { visitedViews: [], @@ -155,6 +158,32 @@ const tagsView = { updateVisitedView({ commit }, view) { commit('UPDATE_VISITED_VIEW', view) + }, + addPageDetail({ commit, state }, params) { + return new Promise((resolve, reject) => { + const Detail = params.component + const Component = Vue.component(params.name, { + components: { Detail }, + render() { + return + } + }) + router.addRoutes([ + { + path: '', + component: Layout, + children: [ + { + path: params.path, + name: params.name, + component: Component, + meta: params.meta + } + ] + } + ]) + resolve() + }) } } } diff --git a/src/views/example/detail.vue b/src/views/example/detail.vue new file mode 100644 index 00000000..58d62f7c --- /dev/null +++ b/src/views/example/detail.vue @@ -0,0 +1,15 @@ + + + diff --git a/src/views/example/list.vue b/src/views/example/list.vue index 85ae4e43..c80dd47a 100644 --- a/src/views/example/list.vue +++ b/src/views/example/list.vue @@ -41,11 +41,12 @@ - + @@ -56,12 +57,14 @@