fix router
This commit is contained in:
1 parent
8088538589
commit
c6a962a089
8 files changed
+46
-45
No files matched your search
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
<title>知数云</title>
|
<title>知数云</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app" class="h-screen"></div>
|
<div id="app"></div>
|
||||||
<script type="module" src="/src/main.ts"></script>
|
<script type="module" src="/src/main.ts"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@element-plus/icons": "^0.0.11",
|
"@element-plus/icons": "^0.0.11",
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
|
"diff-match-patch": "^1.0.5",
|
||||||
"element-plus": "^1.1.0-beta.7",
|
"element-plus": "^1.1.0-beta.7",
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^7.32.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.3.0",
|
||||||
|
|||||||
+34
-5
@@ -1,10 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-container class="h-screen">
|
<el-container :class="showFullHeight ? 'h-screen' : ''">
|
||||||
<el-header>
|
<el-header>
|
||||||
<top-header />
|
<top-header />
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-aside width="250px">
|
<el-aside width="250px" v-if="showSidebar">
|
||||||
<sidebar />
|
<sidebar />
|
||||||
</el-aside>
|
</el-aside>
|
||||||
<el-main>
|
<el-main>
|
||||||
@@ -17,13 +17,42 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Sidebar from '@/components/content/Sidebar.vue';
|
import Sidebar from '@/components/content/Sidebar.vue';
|
||||||
import { TopHeader } from '@/components/common/index';
|
import { TopHeader } from '@/components/common/index';
|
||||||
export default {
|
import { defineComponent } from 'vue';
|
||||||
|
|
||||||
|
interface IData {
|
||||||
|
routes: {
|
||||||
|
detail: string[];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
TopHeader,
|
TopHeader,
|
||||||
Sidebar
|
Sidebar
|
||||||
},
|
},
|
||||||
name: 'LayoutContent'
|
data(): IData {
|
||||||
};
|
return {
|
||||||
|
routes: {
|
||||||
|
detail: ['article-detail']
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
name: 'LayoutContent',
|
||||||
|
computed: {
|
||||||
|
showSidebar(): boolean {
|
||||||
|
console.log('router', this.$route.name);
|
||||||
|
return !this.isDetailRoute();
|
||||||
|
},
|
||||||
|
showFullHeight(): boolean {
|
||||||
|
return !this.isDetailRoute();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
isDetailRoute(): boolean {
|
||||||
|
return this.routes.detail.includes(this.$route.name?.toString() || '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export default defineComponent({
|
|||||||
methods: {
|
methods: {
|
||||||
onEdit(row: IArticle) {
|
onEdit(row: IArticle) {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'article-edit',
|
name: 'article-detail',
|
||||||
params: {
|
params: {
|
||||||
id: row.id
|
id: row.id
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,6 @@ export default {
|
|||||||
},
|
},
|
||||||
component: () => import('@/layouts/Content.vue'),
|
component: () => import('@/layouts/Content.vue'),
|
||||||
children: [
|
children: [
|
||||||
{
|
|
||||||
path: 'editor',
|
|
||||||
name: 'editor',
|
|
||||||
meta: {
|
|
||||||
title: t('common.nav.editor')
|
|
||||||
},
|
|
||||||
component: () => import('@/pages/content/Editor.vue')
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: 'article',
|
path: 'article',
|
||||||
name: 'article-index',
|
name: 'article-index',
|
||||||
@@ -24,6 +16,14 @@ export default {
|
|||||||
},
|
},
|
||||||
component: () => import('@/pages/content/article/Index.vue')
|
component: () => import('@/pages/content/article/Index.vue')
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'article/:id',
|
||||||
|
name: 'article-detail',
|
||||||
|
meta: {
|
||||||
|
title: t('common.nav.article')
|
||||||
|
},
|
||||||
|
component: () => import('@/pages/editor/article/Detail.vue')
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'platform',
|
path: 'platform',
|
||||||
name: 'platform-index',
|
name: 'platform-index',
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
import { t } from '../i18n';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
path: '/editor',
|
|
||||||
name: 'editor',
|
|
||||||
meta: {
|
|
||||||
title: t('common.nav.editor')
|
|
||||||
},
|
|
||||||
component: () => import('@/layouts/Editor.vue'),
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: 'article/:id',
|
|
||||||
name: 'article-edit',
|
|
||||||
meta: {
|
|
||||||
title: t('common.nav.article')
|
|
||||||
},
|
|
||||||
component: () => import('@/pages/editor/article/Detail.vue')
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
+1
-3
@@ -1,6 +1,5 @@
|
|||||||
import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router';
|
import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router';
|
||||||
import content from './content';
|
import content from './content';
|
||||||
import editor from './editor';
|
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
@@ -8,8 +7,7 @@ const routes = [
|
|||||||
name: 'home',
|
name: 'home',
|
||||||
component: () => import('@/pages/Home.vue')
|
component: () => import('@/pages/Home.vue')
|
||||||
},
|
},
|
||||||
content,
|
content
|
||||||
editor
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
|
|||||||
@@ -2247,13 +2247,6 @@ v8-compile-cache@^2.0.3:
|
|||||||
resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee"
|
resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee"
|
||||||
integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==
|
integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==
|
||||||
|
|
||||||
vditor@^3.8.6:
|
|
||||||
version "3.8.6"
|
|
||||||
resolved "https://registry.yarnpkg.com/vditor/-/vditor-3.8.6.tgz#95a89c4865efa740bf55f2a7e3f968b395987a60"
|
|
||||||
integrity sha512-KZSmg593dTx/BmX9HdXcZCLi5stkJvW3AHVq4gOVvA00JnZngT7sjlX8WlfWbLe0A80UzelNSVXff3yoyljRAA==
|
|
||||||
dependencies:
|
|
||||||
diff-match-patch "^1.0.5"
|
|
||||||
|
|
||||||
vite@^2.5.1:
|
vite@^2.5.1:
|
||||||
version "2.5.1"
|
version "2.5.1"
|
||||||
resolved "https://registry.yarnpkg.com/vite/-/vite-2.5.1.tgz#953c71a034c07b3ae0448d57664ec9c6862f23a8"
|
resolved "https://registry.yarnpkg.com/vite/-/vite-2.5.1.tgz#953c71a034c07b3ae0448d57664ec9c6862f23a8"
|
||||||
|
|||||||
Reference in new issue
Block a user