vue的联级选择器(单选)点击单选框选中改点击整行选中


1,模板方面使用elementui的联级选择器

              <el-cascader
                ref="refHandle"
                v-model="cashTypeValue"
                :options="cashTypeData"
                :props="{ checkStrictly: true,expandTrigger: 'hover',emitPath: false }"
                :show-all-levels="false"
                placeholder="流水类型"
                clearable
                @change="handleChange"></el-cascader>

2,通过css修改选中的区域有单选框改为整行,注意需要在全局样式中修改

.el-cascader-panel .el-radio {
  width: 132px;
  height: 34px;
  line-height: 34px;
  padding: 0 10px;
  z-index: 10;
  position: absolute;
}
.el-cascader-panel .el-radio__input {
  visibility: hidden;
}
.el-cascader-panel .el-cascader-node__postfix {
  top: 10px;
}

3,change事件点击后关闭弹框

    handleChange(cashTypeValue) {//监听值发生变化就关闭部门联级帅选器
      if (this.$refs.refHandle) {
        this.$refs.refHandle.dropDownVisible = false;
      }
      this.rechargeLog.params.type = !!cashTypeValue?cashTypeValue:'';
      this.search();
    },

 


免责声明!

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



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