vue Ant Design 树选择使用(选中子节点显示各级父节点;选中父节点不选中子节点)


效果图:

 

 

 <a-descriptions-item label="治疗方式">
            <a-form-model-item prop="treatments">
              <template>
                <a-tree-select
                  labelInValue
                  v-model="otherFrom.treatments"
                  show-search
                  style="width: 100%"
                  :value="otherFrom.treatments"
                  :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                  :tree-data="treatmentData"
                  placeholder="请选择治疗方式"
                  allow-clear
                  multiple
                  tree-default-expand-all
                  @change="onChange"
                  @search="onSearch"
                  @select="onSelect"
                >
                </a-tree-select>
              </template>
            </a-form-model-item>
          </a-descriptions-item>
方法:

methods: {
    onChange(value, e) {
      console.log(value);
      for (let i = 0; i < value.length; i++) {
        value[i].label = value[i].value;
      }
      this.otherFrom.treatments = value;
    },

}

 


免责声明!

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



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