diff --git a/src/router/index.js b/src/router/index.js index dc07a7213066e9e7e056729c73829445a58aaf12..3d49cf3959539a3c08daee80b3f9bdeb04534801 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -56,7 +56,8 @@ const DynamicTable = () => import('../views/example/table/dynamictable'); const Table = () => import('../views/example/table/table'); const DragTable = () => import('../views/example/table/dragTable'); const InlineEditTable = () => import('../views/example/table/inlineEditTable'); -const Form1 = () => import('../views/example/form1'); + +const Form = () => import('../views/example/form'); /* permission */ const Permission = () => import('../views/permission/index'); @@ -205,7 +206,8 @@ export const asyncRouterMap = [ { path: 'table', component: Table, name: '综合table' } ] }, - { path: 'form1', component: Form1, name: '综合form1' } + { path: 'form/edit', component: Form, name: '编辑form', meta: { isEdit: true } }, + { path: 'form/create', component: Form, name: '创建form' } ] }, { path: '*', redirect: '/404', hidden: true } diff --git a/src/views/example/form1.vue b/src/views/example/form.vue similarity index 96% rename from src/views/example/form1.vue rename to src/views/example/form.vue index ff982ec9fc4e6dcdd0516109924bf2d030f8147b..c48fcb91b03cd2e60406f53582605336f702da47 100644 --- a/src/views/example/form1.vue +++ b/src/views/example/form.vue @@ -7,6 +7,9 @@
+ + 创建form + {{!postForm.comment_disabled?'评论已打开':'评论已关闭'}} @@ -185,10 +188,16 @@ computed: { contentShortLength() { return this.postForm.content_short.length + }, + isEdit() { + return this.$route.meta.isEdit // 根据meta判断 + // return this.$route.path.indexOf('edit') !== -1 // 根据路由判断 } }, created() { - this.fetchData(); + if (this.isEdit) { + this.fetchData(); + } }, methods: { fetchData() {