免费观看又色又爽又黄的小说免费_美女福利视频国产片_亚洲欧美精品_美国一级大黄大色毛片

vue如何實(shí)現(xiàn)側(cè)邊欄導(dǎo)航效果-創(chuàng)新互聯(lián)

這篇文章將為大家詳細(xì)講解有關(guān)vue如何實(shí)現(xiàn)側(cè)邊欄導(dǎo)航效果,小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

成都創(chuàng)新互聯(lián)服務(wù)項(xiàng)目包括沙市網(wǎng)站建設(shè)、沙市網(wǎng)站制作、沙市網(wǎng)頁(yè)制作以及沙市網(wǎng)絡(luò)營(yíng)銷策劃等。多年來(lái),我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢(shì)、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,沙市網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到沙市省份的部分城市,未來(lái)相信會(huì)繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!

最終效果

vue如何實(shí)現(xiàn)側(cè)邊欄導(dǎo)航效果

vue如何實(shí)現(xiàn)側(cè)邊欄導(dǎo)航效果

點(diǎn)擊下一個(gè)導(dǎo)航,上一個(gè)導(dǎo)航自動(dòng)收回

vue如何實(shí)現(xiàn)側(cè)邊欄導(dǎo)航效果

實(shí)現(xiàn)代碼

1.下載vue-router

npm install vue-router --save-dev

2.在main.js中引入

import Vue from 'vue'
import Router from 'vue-router' 
Vue.use(Router) // 引入路由

3.在components中新建組件

3.1 agencySearch.vue組件

代碼:

<template>
 <div>
  直屬下線代理查詢
 </div>
</template>

3.2 agencySet.vue組件

代碼

<template>
 <div>
  直屬下線代理設(shè)置
 </div>
</template>

3.3 financialIncome.vue組件

代碼

<template>
 <div>
  財(cái)務(wù)收益數(shù)據(jù)報(bào)表
 </div>
</template>

4.在router下的index.js中引入組件,搭配路由

//4.1引入組件
import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/components/Home' // 主頁(yè)
import agencySearch from '@/components/agencySearch' // 直屬下線代理查詢
import agencySet from '@/components/agencySet' // 直屬下線代理設(shè)置
Vue.use(Router)
//搭配路由
export default new Router({
 mode: 'history',
 scrollBehavior: () => ({
 y: 0
 }),
 routes: [
 {
  // 主頁(yè)
  path: '/',
  component: Home,
  name: '代理事物',
  iconCls: 'el-icon-message',
  children: [{
  path: '/agencySearch',
  component: agencySearch,
  name: '直屬下線代理查詢',
  hidden: true
  },
  {
  path: '/agencySet',
  component: agencySet,
  name: '直屬下線代理設(shè)置'
  }]
 },
 {
  // 主頁(yè)
  path: '/',
  component: Home,
  name: '財(cái)務(wù)報(bào)表',
  iconCls: 'el-icon-menu',
  children: [{
  path: '/financialIncome',
  component: financialIncome,
  name: '財(cái)務(wù)收益數(shù)據(jù)報(bào)表',
  hidden: true
  }]
 }]
})

5.在主頁(yè)Home組件中搭配導(dǎo)航以及路由出口

在el-menu標(biāo)簽中一定要有 unique-opened 和 router屬性,在el-menu-item中index屬性值等于在router下index.js中配好的路由名字

這個(gè)是從element官網(wǎng)截取的

vue如何實(shí)現(xiàn)側(cè)邊欄導(dǎo)航效果

vue如何實(shí)現(xiàn)側(cè)邊欄導(dǎo)航效果

<el-row class="tac">
 <el-col :span="24">
 <el-menu
  default-active="1"
  class="el-menu-vertical-demo"
  unique-opened 
  router>
  <el-submenu index="1">
  <template slot="title">
   <i class="el-icon-message"></i>
   <span>代理事務(wù)</span>
  </template>
  <el-menu-item-group>
  <template slot="title"></template>
  <el-menu-item index="/agencySearch">直屬下線代理查詢</el-menu-item>
  <el-menu-item index="/agencySet">直屬下線代理設(shè)置</el-menu-item>
  </el-menu-item-group>
  </el-submenu>
  <el-submenu index="2">
  <template slot="title">
   <i class="el-icon-menu"></i>
   <span>財(cái)務(wù)報(bào)表</span>
  </template>
  <el-menu-item-group>
  <template slot="title"></template>
  <el-menu-item index="/financialIncome">財(cái)務(wù)收益數(shù)據(jù)報(bào)表</el-menu-item>
  </el-menu-item-group>
  </el-submenu>
 </el-menu>
 </el-col>
</el-row>

路由出口-右側(cè)顯示部分

<el-col :span="24" class="content-wrapper">
 <transition name="fade" mode="out-in">
  <router-view></router-view>
 </transition>
 </el-col>

結(jié)語(yǔ):因?yàn)槭菑膶?xiě)好的代碼中截取的一部分,可能跑不起來(lái),請(qǐng)見(jiàn)諒,我能理解的原理部分都寫(xiě)在這里啦。

關(guān)于“vue如何實(shí)現(xiàn)側(cè)邊欄導(dǎo)航效果”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。

本文題目:vue如何實(shí)現(xiàn)側(cè)邊欄導(dǎo)航效果-創(chuàng)新互聯(lián)
轉(zhuǎn)載來(lái)于:http://m.newbst.com/article38/dcedpp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站網(wǎng)站維護(hù)響應(yīng)式網(wǎng)站ChatGPT品牌網(wǎng)站制作網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都app開(kāi)發(fā)公司