提交 960c1797 编写于 作者: uuai's avatar uuai

路由设置

上级 bcd05ab7
<template>
<router-view></router-view>
</template>
\ No newline at end of file
import routerView from "@/views/form/index";
// import elementFrom from "../views/form/element/from.vue"
import elementFrom from '@/views/form/element/from';
export default [
{
path: '/form',
......@@ -9,46 +6,38 @@ export default [
meta: {
title: '表单配置',
},
component: routerView,
component: 'Layout',
children: [
// {
// path: 'page',
// name: 'page',
// meta: {
// title: '表单配置',
// },
// component: '/views/form/index.vue',
// },
{
path: 'elementPlus',
path: '/elementPlus',
name: 'elementPlus',
meta: {
title: 'element-plus',
},
component: routerView,
component: 'routerView',
// redirect: '/form/elementPlus/elementFrom',
children: [
{
path: 'elementFrom',
path: '/form/elementPlus/elementFrom',
name: 'elementFrom',
meta: {
title: '表单筛选',
},
component: elementFrom
component: '/views/form/element/from.vue'
},
]
},
{
path: 'antdVue',
path: '/antdVue',
name: 'antdVue',
meta: {
title: 'antdVue',
},
component: routerView,
component: 'routerView',
// redirect: '/form/antdVue/antdForm',
children: [
{
path: 'antdForm',
path: '/antdForm',
name: 'antdForm',
meta: {
title: 'antd表单',
......@@ -56,7 +45,7 @@ export default [
component: '/views/form/antd/form.vue',
},
{
path: 'screening',
path: '/screening',
name: 'screening',
meta: {
title: '条件筛选',
......@@ -68,164 +57,164 @@ export default [
]
},
// {
// path: '/antd',
// name: 'antd',
// meta: {
// title: 'antd二次封装',
// },
// component: routerView,
// children: [
// {
// path: 'antdDemo',
// name: 'antdDemo',
// title: 'demo',
// meta: {
// title: 'demo',
// },
// component: '/views/antd/index.vue',
// },
// {
// path: 'modal',
// name: 'modal',
// title: '对话框',
// meta: {
// title: '对话框',
// },
// component: '/views/antd/modal/index.vue',
// },
// {
// path: 'drawer',
// name: 'drawer',
// title: '抽屉',
// meta: {
// title: '抽屉',
// },
// component: '/views/antd/drawer/index.vue',
// },
// {
// path: 'table',
// name: 'table',
// title: '表格',
// meta: {
// title: '表格',
// },
// component: '/views/antd/table/index.vue',
// },
//
// ]
// },
// {
// path: '/tool',
// name: 'tool',
// meta: {
// title: '工具库',
// },
// component: routerView,
// children: [
// {
// path: 'md',
// name: 'md',
// title: 'md编译器',
// meta: {
// title: 'md编译器',
// },
// component: '/views/tool/mdEditor.vue',
// },
// {
// path: 'digitalTokens',
// name: 'digitalTokens',
// title: '数字令牌',
// meta: {
// title: '数字令牌',
// },
// component: '/views/tool/digitalTokens/index.vue',
// },
// {
// path: 'ui',
// name: 'ui',
// title: 'ui库插件化',
// meta: {
// title: 'ui库插件化',
// },
// component: '/views/MyUI/UI.vue',
// },
// ]
// },
// {
// path: '/skills',
// name: 'skills',
// meta: {
// title: '知识点',
// },
// component: routerView,
// children: [
// {
// path: 'vue3',
// name: 'vue3',
// title: 'vue3',
// meta: {
// title: 'vue3',
// },
// component: routerView,
// children: [
// {
// path: 'fnApi',
// name: 'fnApi',
// meta: {
// title: 'vue3开发技巧',
// },
// component: '/views/skills/vue3/fnApi.vue',
// },
// ]
// },
// ]
// },
// {
// path: '/chart',
// name: 'chart',
// meta: {
// title: '图表',
// },
// component: routerView,
// children: [
// {
// path: 'charts',
// name: 'charts',
// title: 'charts',
// meta: {
// title: 'charts',
// },
// component: '/views/chart/index.vue',
// }, {
// path: 'configuration',
// name: 'configuration',
// title: 'charts配置',
// meta: {
// title: 'charts配置',
// },
// component: '/views/chart/configuration.vue',
// },
// ]
// },
// {
// path: '/node',
// name: 'node',
// meta: {
// title: 'sqlite',
// },
// component: routerView,
// children: [
// {
// path: 'sqlite',
// name: 'sqlite',
// title: 'sqlite',
// meta: {
// title: 'sqlite',
// },
// component: '/views/node/sqlite3/index.vue',
// }
// ]
// },
{
path: '/antd',
name: 'antd',
meta: {
title: 'antd二次封装',
},
component: 'Layout',
children: [
{
path: '/antdDemo',
name: 'antdDemo',
title: 'demo',
meta: {
title: 'demo',
},
component: '/views/antd/index.vue',
},
{
path: '/modal',
name: 'modal',
title: '对话框',
meta: {
title: '对话框',
},
component: '/views/antd/modal/index.vue',
},
{
path: '/drawer',
name: 'drawer',
title: '抽屉',
meta: {
title: '抽屉',
},
component: '/views/antd/drawer/index.vue',
},
{
path: '/table',
name: 'table',
title: '表格',
meta: {
title: '表格',
},
component: '/views/antd/table/index.vue',
},
]
},
{
path: '/tool',
name: 'tool',
meta: {
title: '工具库',
},
component: 'Layout',
children: [
{
path: '/md',
name: 'md',
title: 'md编译器',
meta: {
title: 'md编译器',
},
component: '/views/tool/mdEditor.vue',
},
{
path: '/digitalTokens',
name: 'digitalTokens',
title: '数字令牌',
meta: {
title: '数字令牌',
},
component: '/views/tool/digitalTokens/index.vue',
},
{
path: '/ui',
name: 'ui',
title: 'ui库插件化',
meta: {
title: 'ui库插件化',
},
component: '/views/MyUI/UI.vue',
},
]
},
{
path: '/skills',
name: 'skills',
meta: {
title: '知识点',
},
component: "Layout",
children: [
{
path: '/vue3',
name: 'vue3',
title: 'vue3',
meta: {
title: 'vue3',
},
component: 'routerView',
children: [
{
path: '/fnApi',
name: 'fnApi',
meta: {
title: 'vue3开发技巧',
},
component: '/views/skills/vue3/fnApi.vue',
},
]
},
]
},
{
path: '/chart',
name: 'chart',
meta: {
title: '图表',
},
component: "Layout",
children: [
{
path: '/charts',
name: 'charts',
title: 'charts',
meta: {
title: 'charts',
},
component: '/views/chart/index.vue',
}, {
path: '/configuration',
name: 'configuration',
title: 'charts配置',
meta: {
title: 'charts配置',
},
component: '/views/chart/configuration.vue',
},
]
},
{
path: '/node',
name: 'node',
meta: {
title: 'sqlite',
},
component: "Layout",
redirect: '/sqlite',
children: [
{
path: '/sqlite',
name: 'sqlite',
title: 'sqlite',
meta: {
title: 'sqlite',
},
component: '/views/node/sqlite3/index.vue',
}
]
},
{path: '/:pathMatch(.*)', hidden: true, redirect: '/'} //当用户输入页面链接错误或者没有该页面时,显示该路径页面
]
import Layout from "@/views/layout/index.vue";
import routerView from "@/views/form/index.vue";
export default [
{
path: '/login',
name: 'login',
component: () => import('@/views/Login/Login.vue'),
hidden: false
hidden: true
},
// {
// path: '/login2',
// name: 'login2',
// // component: () => import('@/views/welcome/index.vue'),
// component: () => import('@/views/form/element/from.vue'),
// // component: '/views/form/element/from.vue',
// // hidden: true
// },
{
path: '/',
component: Layout,
......@@ -26,7 +19,7 @@ export default [
},
children: [
{
path: 'welcome',
path: '/welcome',
name: 'welcome',
title: '欢迎页',
meta: {
......@@ -36,4 +29,52 @@ export default [
}
]
},
// {
// path: '/antd',
// name: 'antd',
// meta: {
// title: 'antd二次封装',
// },
// component: Layout,
// children: [
// {
// path: '/antdDemo',
// name: 'antdDemo',
// title: 'demo',
// meta: {
// title: 'demo',
// },
// // component: '/views/antd/index.vue',
// component: () => import('@/views/antd/index.vue')
// },
// {
// path: '/modal',
// name: 'modal',
// title: '对话框',
// meta: {
// title: '对话框',
// },
//
// component: () => import('@/views/antd/modal/index.vue'),
// },
// {
// path: '/drawer',
// name: 'drawer',
// title: '抽屉',
// meta: {
// title: '抽屉',
// },
// component: () => import('@/views/antd/drawer/index.vue'),
// },
// {
// path: '/table',
// name: 'table',
// title: '表格',
// meta: {
// title: '表格',
// },
// component: () => import('@/views/antd/table/index.vue'),
// },
// ]
// },
]
\ No newline at end of file
import {createRouter, createWebHistory} from 'vue-router'
import {createRouter, createWebHistory,createWebHashHistory} from 'vue-router'
// 基本路由信息
import baseRouter from './baseRouter'
......@@ -6,7 +6,7 @@ import baseRouter from './baseRouter'
console.log(baseRouter);
const router = createRouter({
history: createWebHistory(), //===>mode:"history"
history: createWebHashHistory(), //===>mode:"history"
routes: baseRouter
})
......
......@@ -24,6 +24,7 @@ function hasPermission(roles, route) {
const comp = import.meta.glob(`/src/views/**/*/*.vue`);
// const comp = comp1.concat(comp2)
import Layout from "@/views/layout/index.vue";
import routerView from "@c/routerView/index.vue";
console.log('component', comp);
......@@ -49,6 +50,8 @@ function filterAsyncRouter(asyncRouterMap) { //遍历后台传来的路由字符
if (route.component) {
if (route.component === 'Layout') { //Layout组件特殊处理
route.component = Layout;
}else if (route.component === 'routerView') { //Layout组件特殊处理
route.component = routerView;
} else {
route.component = comp['/src' + route.component]
}
......
......@@ -10,7 +10,7 @@
>
<slot></slot>
</a-modal>
<button>模态框</button>
</template>
<script>
......
......@@ -12,35 +12,28 @@
v-model:openKeys="openKeys"
v-model:selectedKeys="selectedKeys"
>
<!-- <a-menu-item v-for="(item,index) in router" :key="item.path">-->
<!-- <router-link :to="item.path"> {{ item.path }}</router-link>-->
<!-- </a-menu-item>-->
<div v-for="(item,index) in router" :key="index">
<a-sub-menu :key="item.path" v-if="!item.hidden">
<!-- <template #icon>-->
<!-- <AppstoreOutlined/>-->
<!-- </template>-->
<template #title>{{ item.path }}</template>
<div v-if="item.children" v-for="(c,cIndex) in item.children">
<a-sub-menu :key="c.path"
:title="c.meta.title"
v-if="c.children">
<!-- 三级 :key="index + cIndex + childIndex + (index+cIndex)"-->
<a-menu-item v-for="(child,childIndex) in c.children"
:key="child.path">
<router-link :to="child.path">
{{ child.meta.title }}
</router-link>
<!-- <a-menu-item v-if="!item.hidden && item.children.length<=1" :key="item.path">-->
<!-- <router-link :to="item.path"> {{ item.meta.title }} 一级 {{ item.path }}</router-link>-->
<!-- </a-menu-item>-->
<div v-if="!item.hidden" :key="item.name">
<a-sub-menu :key="item.name">
<template #title>{{ item.meta.title }}</template>
<div v-if="item.children" v-for="(child,index) in item.children">
<a-menu-item v-if="!child.children" :key="child.name">
<router-link :to="child.name"> {{ child.meta.title }}</router-link>
</a-menu-item>
</a-sub-menu>
<!--二级-->
<a-menu-item v-else :key="c.path">
<span :to="{name:c.name}">{{ c.meta.title }} -name {{ c.path }}</span>
</a-menu-item>
<a-sub-menu v-else :key="child.name">
<template #title>{{ child.meta.title }} 二级</template>
<a-menu-item v-for="(children,index) in child.children" :key="children.name">
<router-link :to="children.path"> {{ children.meta.title }}</router-link>
</a-menu-item>
</a-sub-menu>
</div>
</a-sub-menu>
</div>
</div>
</a-sub-menu>
</div>
</a-menu>
</div>
......
<template>
<div>数字令牌</div>
</template>
<script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册