欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Vue2+element-ui實(shí)現(xiàn)面包屑導(dǎo)航

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

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

1、面包屑導(dǎo)航欄布局

代碼:

<template>
? ? <!--面包屑導(dǎo)航頁簽-->
? ? <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>

在使用面包屑導(dǎo)航的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'時(shí)重定向到/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è)邊導(dǎo)航欄樣式

代碼:

<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)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論