IView 使用

1.手动更新Menu菜单当前子菜单所在的菜单项以及选中当前项

<Menu ref="navBar" :theme="theme2" width="auto" :open-names="open" :active-name="activeName" :accordion="accordion" @on-select="chooseState">
        <Submenu name="1">
          <template slot="title">
            <Icon type="ios-people" />
            统计
          </template>
          <MenuItem name="/index" to="/index" id="statistics">统计数据</MenuItem>
        </Submenu>
        <Submenu name="2">
          <template slot="title">
            <Icon type="ios-people" />
            会员管理
          </template>
          <MenuItem name="/index/member/member" to="/index/member/member">会员列表</MenuItem>
          <MenuItem name="/index/member/recommend" to="/index/member/recommend">推荐列表</MenuItem>
        </Submenu>
</Menu>

js

data(){
        return {
          theme2: 'dark',
          activeName:this.$route.path,
          accordion:true,
          open:[]
        }
      },
      watch:{
        '$route'(){
          this.activeName = this.$route.path;//选中当前项
        }
      },
      methods:{
        chooseState(name){
          console.log(name);
        },
        watchRouter(){
          this.$nextTick(()=> {//手动更新Menu菜单当前子菜单所在的菜单项
            this.$refs.navBar.$children.forEach((item) => {
              item.opened = item.active?true:false
            })
          });
        }
      },
      mounted() {
        this.watchRouter();
      }

2.

用IView+vue做后台项目,使用IView组件Tree时,接触了vue中的render函数,对render函数一点也不了解

这是我在百度上找到的一篇文章,看到以后,对render函数了解了

https://segmentfault.com/a/1190000010913794?utm_source=tag-newest

原文地址:https://www.cnblogs.com/dyy-dida/p/10584234.html