在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ vue 元素加了v-for只渲染了一次 之后消失了

vue 元素加了v-for只渲染了一次 之后消失了

不知道是不是我數(shù)據(jù)處理得不對(duì) 還是怎么著 里面的router-link在第一次的時(shí)候可以渲染出來 如果刷新頁(yè)面 或者跳轉(zhuǎn)到其它頁(yè)面再跳轉(zhuǎn)回來 里面這循環(huán)出來的router-link就沒有了 不是內(nèi)容沒有出來 而是標(biāo)簽都沒有 只有外層的div在 這時(shí)候需要改代碼保存之后才能出來 但是刷新又沒了
這是為什么呢 太奇怪了

又試了下 發(fā)現(xiàn)不是router-link的問題 如果換成其它標(biāo)簽也是一樣的問題 只要加了這個(gè)v-for就出這問題
<template>
<div class="InformationMenu">

<div class="slide-bar-wrapper">
    <router-link to="" v-for="(firstMenu,idx) in menus" :key="idx">
      {{firstMenu.title}}
      <div class="" v-if="firstMenu.sourceUrl == ''">
        <router-link to="" v-for="(secondMenue,index) in firstMenu.secondMenueLists" :key="index">{{secondMenue.title}}</router-link>
      </div>
    </router-link>
</div>

</div>
</template>

<script>
import infoDisclosure from 'service/infoDisclosure'

export default {
data() {
  return {
    showMenue: true,
    menus: []
  }
},
created() {
  infoDisclosure.getMenue({parentId: 0}).then((res) => {
    this.menus =  res.data
    this.menus.forEach( item => {
      if(item.sourceUrl == '') {
        infoDisclosure.getMenue({parentId: item.id}).then((res) => {
          item.secondMenueLists = res.data
          console.log(item)
        })
      }
    })
  })
},
methods: {
  toggle() {
    this.showMenue = !this.showMenue
  }
}
}

</script>

<style lang="less" scoped>

 @import '~assets/less/index.less';
 .InformationMenu {
     //width: 168px;
     .slide-bar-wrapper {
         //width: 168px;
         & > a {
             display: block;
             width: 180px;
             //height: 60px;
             line-height: 60px;
             color: @gray-color;
      background-color: #F2F2F2;
      border-top: 1px solid #e5e5e5;
      border-bottom: 1px solid #e5e5e5;
          font-size: 18px;
             text-align: center;
             border-bottom: 1px solid @border-bottom-color;
             position: relative;
      div {
        a {
          display: block;
          font-size: 16px;
          color: #666666;
          background-color: #F2F2F2;
          //height: 60px;
          line-height: 60px;
          text-indent: 64px;
          &.router-link-exact-active {
            background-color: @white-color;
            border-left: 3px solid #ff6633;
            color: #ff4800;
            font-weight: bold;
          }
        }
      }
             &.router-link-exact-active {
        background-color: @white-color;
        border-left: 3px solid #ff6633;
                 color: #ff6633;
             }
         }
     }

 }

</style>

回答
編輯回答
巴扎嘿

自己解決了 用$set方法就可以了

2017年1月13日 08:12