Elementui Cascader 选择任意一级选项插件,选中最后一级圆圈关闭下拉


页面:
<el-cascader
                v-model="areaId"
                ref="refHandle"
                :options="areaList"
                :props="{ checkStrictly: true }"
                @change="handleChange"
                expand-trigger="hover"
                clearable
              ></el-cascader>
逻辑:
 watch:{
    areaId:{
      handler(newVal, oldVal) {
        if (this.$refs.refHandle) {
          var children = this.$refs.refHandle.getCheckedNodes();
          if(children[0].children.length < 1){   //判断有没有下级
            this.$refs.refHandle.dropDownVisible = false; //监听值发生变化就关闭它
          }
        }
      },
    }
  }

  判断值有没有变化,变化切没有下一级,关闭级联选择


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM