mirror of
https://github.com/fantastic-admin/basic.git
synced 2026-10-07 13:07:58 +08:00
优化代码,为vue-router 4做准备
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
<template>
|
||||
<router-link :to="to" :class="{
|
||||
<router-link v-slot="{ navigate }" custom :to="to" :class="{
|
||||
'title': true,
|
||||
'is-link': $store.state.settings.enableDashboard
|
||||
}" :title="title" tag="div"
|
||||
>
|
||||
<img v-if="showLogo" :src="logo" class="logo">
|
||||
<span v-if="showTitle">{{ title }}</span>
|
||||
<div @click="navigate">
|
||||
<img v-if="showLogo" :src="logo" class="logo">
|
||||
<span v-if="showTitle">{{ title }}</span>
|
||||
</div>
|
||||
</router-link>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<div class="tips">你可以使用快捷键<span>alt</span>+<span>s</span>唤醒搜索面板,按<span>esc</span>退出</div>
|
||||
</div>
|
||||
<div ref="search" class="result">
|
||||
<router-link v-for="item in resultList" :key="item.path" v-slot="{ href, navigate }" :to="isShow ? item.path : ''">
|
||||
<router-link v-for="item in resultList" :key="item.path" v-slot="{ href, navigate }" custom :to="isShow ? item.path : ''">
|
||||
<a :href="isExternal(item.path) ? item.path : href" class="item" :target="isExternal(item.path) ? '_blank' : '_self'" @click="navigate">
|
||||
<div class="icon">
|
||||
<svg-icon v-if="item.icon" :name="item.icon" />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div v-if="item.meta.sidebar !== false">
|
||||
<router-link v-if="!hasChildren" v-slot="{ href, navigate, isActive, isExactActive }" :to="resolvePath(item.path)">
|
||||
<router-link v-if="!hasChildren" v-slot="{ href, navigate, isActive, isExactActive }" custom :to="resolvePath(item.path)">
|
||||
<a :href="isExternal(resolvePath(item.path)) ? resolvePath(item.path) : href" :class="[isActive && 'router-link-active', isExactActive && 'router-link-exact-active']" :target="isExternal(resolvePath(item.path)) ? '_blank' : '_self'" @click="navigate">
|
||||
<el-menu-item :title="item.meta.title" :index="resolvePath(item.path)">
|
||||
<svg-icon v-if="item.meta.icon" :name="item.meta.icon" />
|
||||
|
||||
+4
-2
@@ -152,8 +152,10 @@ router.beforeEach(async(to, from, next) => {
|
||||
asyncRoutes,
|
||||
currentPath: to.path
|
||||
})
|
||||
router.addRoutes(accessRoutes)
|
||||
router.addRoutes(lastRoute)
|
||||
accessRoutes.push(...lastRoute)
|
||||
accessRoutes.forEach(route => {
|
||||
router.addRoute(route)
|
||||
})
|
||||
next({ ...to, replace: true })
|
||||
}
|
||||
if (store.state.menu.isGenerate) {
|
||||
|
||||
@@ -130,7 +130,7 @@ export default [
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'videosExampleVideo6',
|
||||
name: 'videosExampleVideo7',
|
||||
component: () => import(/* webpackChunkName: 'videos_example' */ '@/views/videos_example/7'),
|
||||
meta: {
|
||||
title: '07 路由和侧边栏导航',
|
||||
|
||||
Reference in New Issue
Block a user