亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Vue2+element-ui實現(xiàn)面包屑導航

 更新時間:2022年04月12日 09:51:54   作者:kisushotto  
這篇文章主要為大家詳細介紹了Vue2+element-ui使用面包屑導航的正確姿勢,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了Vue2+element-ui實現(xiàn)面包屑導航的具體代碼,供大家參考,具體內(nèi)容如下

1、面包屑導航欄布局

代碼:

<template>
? ? <!--面包屑導航頁簽-->
? ? <div style="padding: 25px 0;flex: 1">
? ? ? ? <el-breadcrumb separator-class="el-icon-arrow-right">
? ? ? ? ? ? <el-breadcrumb-item v-for="breadCrumbItem in breadCrumbList" :key="breadCrumbItem.path" :to="breadCrumbItem.path">
? ? ? ? ? ? ? ? {{breadCrumbItem.meta.title}}
? ? ? ? ? ? </el-breadcrumb-item>
? ? ? ? </el-breadcrumb>
? ? </div>
</template>

在使用面包屑導航的vue文件里添加:

<script>
? ? export default {
? ? ? ? computed: {
? ? ? ? ? ? breadCrumbList() {
? ? ? ? ? ? ? ? return this.$route.matched;
? ? ? ? ? ? }
? ? ? ? },
? ? }
</script>

2、index.js里面配置路由:

import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
? ? //主頁
? ? {
? ? ? ? path: '/',
? ? ? ? component: () => import(/* webpackChunkName: "about" */ '../views/Manage.vue'),
? ? ? ? redirect: "/home", ?/*請求'/manage'時重定向到/manage/home路由*/
? ? ? ? meta: {title: ""}, ?//定義其他屬性
? ? ? ? children: [
? ? ? ? ? ? {
? ? ? ? ? ? ? ? path: "home", name: '主頁', meta: {title: "主頁"}, component: () => import("../views/Home")
? ? ? ? ? ? },
? ? ? ? ]
? ? },
? ? //系統(tǒng)管理
? ? {
? ? ? ? path: '/sys',
? ? ? ? component: () => import(/* webpackChunkName: "about" */ '../views/Manage.vue'),
? ? ? ? meta: {title: "系統(tǒng)管理"}, ?//定義其他屬性
? ? ? ? redirect: "/home",
? ? ? ? //用戶界面子路由
? ? ? ? children: [
? ? ? ? ? ? {
? ? ? ? ? ? ? ? path: "user", name: '用戶管理', meta: {title: "用戶管理"}, component: () => import("../views/User")
? ? ? ? ? ? },
? ? ? ? ? ? {
? ? ? ? ? ? ? ? path: "order", name: '訂單管理', meta: {title: "訂單管理"}, component: () => import("../views/Order")
? ? ? ? ? ? }
? ? ? ? ]
? ? }
]
const router = new VueRouter({
? ? mode: 'history',
? ? base: process.env.BASE_URL,
? ? routes
})
export default router

3、側(cè)邊導航欄樣式

代碼:

<template>
?? ?<el-menu>
?? ??? ?<!--主頁-->
? ? ? ? <el-menu-item index="/">
? ? ? ? ? ? <template slot="title"><i class="el-icon-s-home"></i>
? ? ? ? ? ? ? ? <span slot="title">主頁</span>
? ? ? ? ? ? </template>
? ? ? ? </el-menu-item>
? ? ? ? <!--系統(tǒng)菜單-->
? ? ? ? <el-submenu index="/sys">
? ? ? ? ? ? <template slot="title"><i class="el-icon-menu"></i>
? ? ? ? ? ? ? ? <span slot="title">系統(tǒng)管理</span>
? ? ? ? ? ? </template>
? ? ? ? ? ? <el-menu-item index="/sys/user"><i class="el-icon-s-custom"/>用戶管理</el-menu-item>
? ? ? ? ? ? <el-menu-item index="/sys/order"><i class="el-icon-s-check"/>訂單管理</el-menu-item>
? ? ? ? </el-submenu>
?? ?</el-menu>
</template>

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關文章

最新評論