最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue.js實(shí)現(xiàn)左邊導(dǎo)航切換右邊內(nèi)容

 更新時間:2019年10月21日 09:25:33   作者:山有木兮木有枝 心悅君兮君不知  
這篇文章主要為大家詳細(xì)介紹了vue.js實(shí)現(xiàn)左邊導(dǎo)航切換右邊內(nèi)容,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了vue.js左邊導(dǎo)航切換右邊內(nèi)容的具體代碼,供大家參考,具體內(nèi)容如下

<template>
 <div class="layout-container">
 <y-header>
 <div slot="nav"></div>
 </y-header>
 <div class="w">
 <div class="content">
 <div class="account-sidebar">
  <div class="gray-box ">
  <div class="box-inner">
  <ul class="account-nav">
  <li v-for="(item,i) in nav" :key='i'>
   <a href="javascript:;" >
   <div class="account-nav-primary" @click="tabPrimary(item)" :class="{active:item.isActive}">
    <span>{{item.name}}</span>
    <i class="el-icon-arrow-right"></i>
   </div>
   </a>
   <div v-if="item.secondNav==true">
    <ul class="account-nav-second" v-show="show">
    <li v-for="(itemT,j) in item.navSecond" :key='j' :class="{active:itemT.name===title}"
     @click="tabSecond(itemT)">
     <span>{{itemT.name}}</span>
    </li>
    </ul>
   </div>
  </li>
  </ul>
  </div>
  </div>
  <div class="gray-box sidebar-bottom content-center">
  <div class="img-code">
   <img src="../../assets/static/img-code.png" width="100"/>
  </div>
  <span>掃一掃下載APP</span>
  </div>
 </div>
 <div class="account-content">
  <router-view></router-view>
 </div>
 </div>
 </div>
 <y-footer></y-footer>
 </div>
</template>
<script>
 import YFooter from '/common/footer'
 import YHeader from '/common/header'
 
 export default {
 data () {
 return {
 show: true,
 title: '學(xué)院介紹',
 nav: [
  {name: '學(xué)院介紹',
  isActive: false,
  secondNav: true, // 是否存在二級菜單,true為存在
  // path: 'background',
  navSecond: [
  {name: '創(chuàng)建背景', path: 'background'},
  {name: '創(chuàng)建單位', path: 'unit'},
  {name: '創(chuàng)建目的'},
  {name: '管理單位'},
  {name: '運(yùn)行主體'}
  ]
  },
  {name: '關(guān)于我們', path: 'aboutMe', isActive: false, secondNav: false}
 ]
 }
 },
 computed: {
 },
 methods: {
 tabSecond (e) {
 this.$router.push({path: '/college/' + e.path})
 },
 tabPrimary (e) {
 let path = this.$route.path.split('/')[2]
 if (e.secondNav) {
 // this.show = !this.show
  if (path === 'aboutMe') {
  this.$router.push({path: '/college/' + e.navSecond[0].path})
  }
 } else {
  this.$router.push({path: '/college/' + e.path})
 }
 }
 },
 created () {
 let path = this.$route.path.split('/')[2]
 this.nav.forEach(item => {
 item.isActive = false
 if (item.secondNav) {
  item.navSecond.forEach(itemT => {
  if (itemT.path === path) {
  this.title = itemT.name
  if (itemT.name === this.title) {
  item.isActive = true // 當(dāng)屬于子菜單時,父菜單高亮
  }
  }
  })
 } else {
  if (item.path === path) {
  this.title = item.name
  item.isActive = true
  }
 }
 })
 },
 components: {
 YFooter,
 YHeader
 },
 watch: {
 $route (to) {
 let path = to.path.split('/')[2]
 this.nav.forEach(item => {
  item.isActive = false
  if (item.secondNav) {
  item.navSecond.forEach(itemT => {
  if (itemT.path === path) {
  this.title = itemT.name
  if (itemT.name === this.title) {
   item.isActive = true // 當(dāng)屬于子菜單時,父菜單高亮
  }
  }
  })
  } else {
  if (item.path === path) {
  this.title = item.name
  item.isActive = true
  }
  }
 })
 }
 }
 }
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
 @import "../../assets/style/mixin";
 .main {
 background: #fff;
 color: #000;
 }
 a {
 color: #000;
 }
 .w {
 padding-top: 40px;
 }
 .img-code {
 margin: 0px auto 12px;
 }
 .content {
 display: flex;
 height: 100%;
 font-size: 16px;
 }
 .sidebar-bottom {
 margin-top: 20px;
 padding: 16px;
 }
 .content-center {
 text-align: center;
 }
 .account-sidebar {
 width: 210px;
 border-radius: 6px;
 .account-nav {
 padding: 15px 0;
 .active {
  color: #0156AC;
 }
 .active a{
  color: #0156AC;
 }
 li:hover {
  a{
  color: #0156AC;
  }
 }
 li {
 position: relative;
 line-height: 48px;
 .account-nav-primary {
  padding: 0px 20px;
  height: 48px;
  span {
  float: left;
  }
  i {
  float: right;
  line-height: 48px;
  font-size: 14px;
  }
 }
 .account-nav-second {
  li {
  list-style: disc;
  list-style-position: inside;
  height: 48px;
  padding: 0 26px;
  text-align: left;
  color: #5B6976;
  cursor: pointer;
  span {
   margin-left: -14px;
   color: #A9B2BC;
  }
  &:hover{
   color: #0156AC;
   span {
   color: #0156AC;
   }
  }
  }
  .active {
  color: #0156AC;
  span {
   color: #0156AC;
  }
  }
 }
 a {
  display: block;
 }
 &.current {
  a {
  position: relative;
  z-index: 1;
  height: 50px;
  background-color: #98AFEE;
  line-height: 50px;
  color: #FFF;
  }
 }
 }
 }
 }
 .account-content {
 margin-left: 24px;
 flex: 1;
 }
</style>

效果圖:

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

相關(guān)文章

  • 深入理解vue.js中的v-if和v-show

    深入理解vue.js中的v-if和v-show

    這篇文章主要給大家深入的介紹了關(guān)于vue.js中v-if和v-show的相關(guān)資料,文中詳細(xì)介紹兩者的共同點(diǎn)和區(qū)別,通過圖文介紹的非常詳細(xì),對大家具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起看看吧。
    2017-06-06
  • vue如何解決空格和空行報錯的問題

    vue如何解決空格和空行報錯的問題

    這篇文章主要介紹了vue如何解決空格和空行報錯的問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-04-04
  • 從零開始在vue-cli4配置自適應(yīng)vw布局的實(shí)現(xiàn)

    從零開始在vue-cli4配置自適應(yīng)vw布局的實(shí)現(xiàn)

    這篇文章主要介紹了從零開始在vue-cli4配置自適應(yīng)vw布局,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-06-06
  • vue項目記錄鎖定和解鎖功能實(shí)現(xiàn)

    vue項目記錄鎖定和解鎖功能實(shí)現(xiàn)

    這篇文章主要為大家詳細(xì)介紹了vue項目記錄鎖定和解鎖功能實(shí)現(xiàn),文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-03-03
  • Vue+Express實(shí)現(xiàn)登錄狀態(tài)權(quán)限驗(yàn)證的示例代碼

    Vue+Express實(shí)現(xiàn)登錄狀態(tài)權(quán)限驗(yàn)證的示例代碼

    這篇文章主要介紹了Vue+Express實(shí)現(xiàn)登錄狀態(tài)權(quán)限驗(yàn)證的示例代碼,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2019-05-05
  • vue+element_ui上傳文件,并傳遞額外參數(shù)操作

    vue+element_ui上傳文件,并傳遞額外參數(shù)操作

    這篇文章主要介紹了vue+element_ui上傳文件,并傳遞額外參數(shù)操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-12-12
  • Vue項目配置跨域訪問和代理proxy設(shè)置方式

    Vue項目配置跨域訪問和代理proxy設(shè)置方式

    這篇文章主要介紹了Vue項目配置跨域訪問和代理proxy設(shè)置方式,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-09-09
  • 在Uni中使用Vue的EventBus總線機(jī)制操作

    在Uni中使用Vue的EventBus總線機(jī)制操作

    這篇文章主要介紹了在Uni中使用Vue的EventBus總線機(jī)制操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-07-07
  • vue中實(shí)現(xiàn)子組件接收父組件方法并獲取返回值

    vue中實(shí)現(xiàn)子組件接收父組件方法并獲取返回值

    這篇文章主要介紹了vue中實(shí)現(xiàn)子組件接收父組件方法并獲取返回值方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-08-08
  • 在Vue3中使用localStorage保存數(shù)據(jù)的流程步驟

    在Vue3中使用localStorage保存數(shù)據(jù)的流程步驟

    在前端開發(fā)中,尤其是利用Vue3構(gòu)建現(xiàn)代Web應(yīng)用時,掌握如何使用本地存儲(localStorage)來保存數(shù)據(jù)是非常重要的能力,在這篇博客中,我將詳細(xì)介紹如何在Vue3中使用localStorage保存數(shù)據(jù),并提供示例代碼來幫助理解,需要的朋友可以參考下
    2024-06-06

最新評論

浙江省| 波密县| 赣州市| 兴化市| 封丘县| 佛学| 仙桃市| 迁安市| 大安市| 遂宁市| 阳曲县| 嘉荫县| 边坝县| 秦皇岛市| 安吉县| 凤山市| 英吉沙县| 三明市| 临湘市| 牟定县| 松桃| 武清区| 海兴县| 定结县| 石嘴山市| 普陀区| 清河县| 庄河市| 景东| 修武县| 高平市| 嵩明县| 瓮安县| 昆明市| 桦川县| 易门县| 长泰县| 黄龙县| 定边县| 十堰市| 兴海县|