vue使用iview导航栏Menu activeName不生效

activeName不生效

一、问题

根据ivew官网的提示,设置了active-name和open-names以后,发现不管是设置静态是数据还是设置动态的数据,都不生效

一、解决方案,

在设置动态名称的时候,调用menu组件的两个方法
在这里插入图片描述
现在将我的代码放出来,可供参考

<div class="bottom">
      <Menu @on-select="changeMenu" :active-name="activeLocalName" ref="menu">
        <MenuItem v-for="item in LocationSelectList" :key="item.value" :name="item.value">{{ item.text }}</MenuItem>
      </Menu>
 data () {
    return {
      LocationSelectList: null,
      firstLocalName: null,
      activeLocalName: null,
      
    };
  },
 async getDetecLocaltionList () {
      await this.$store.dispatch({
        type: 'security/getDetectLocationSelectList',
        data: {},
      });
      this.LocationSelectList = this.$store.state.security.DetectLocationSelectList;
      if (this.LocationSelectList.length < 1) {
      } else {
        this.activeLocalName = this.LocationSelectList[0].value;
        // 获取到数据以后直接调用方法,我只使用到了选中高亮的方法,所以我只调用了一个
        this.$nextTick(() => {
          (this.$refs.menu).updateActiveName();
        })
       
      }


    },

相关推荐

  1. uniapp导航组件如何使用

    2024-04-04 08:22:02       56 阅读
  2. 3.Swift导航使用

    2024-04-04 08:22:02       52 阅读
  3. iView 中DatePicker日期选择器 v-model生效的情况

    2024-04-04 08:22:02       44 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-04 08:22:02       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-04 08:22:02       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-04 08:22:02       87 阅读
  4. Python语言-面向对象

    2024-04-04 08:22:02       96 阅读

热门阅读

  1. html根据屏幕分辨率大小字体自动变大缩小

    2024-04-04 08:22:02       35 阅读
  2. 智能中的变体

    2024-04-04 08:22:02       37 阅读
  3. delphi 设置win10 dpi 缩放规则

    2024-04-04 08:22:02       33 阅读