cascader组件增加任意级节点可选的配置属性。

master
vdpAdmin 2021-12-17 11:02:00 +08:00
parent b7668d3a44
commit aff51d7ebf
7 changed files with 40 additions and 1 deletions

View File

@ -7,6 +7,8 @@
:size="field.options.size"
:clearable="field.options.clearable"
:filterable="field.options.filterable"
:props="{ checkStrictly: field.options.checkStrictly, expandTrigger: 'hover' }"
@visible-change="hideDropDownOnClick" @expand-change="hideDropDownOnClick"
:placeholder="field.options.placeholder || i18nt('render.hint.selectPlaceholder')"
@focus="handleFocusCustomEvent" @blur="handleBlurCustomEvent"
@change="handleChangeEvent">
@ -89,6 +91,16 @@
},
methods: {
/* 开启任意级节点可选后点击radio隐藏下拉框 */
hideDropDownOnClick() {
setTimeout(() => {
document.querySelectorAll(".el-cascader-panel .el-radio").forEach((el) => {
el.onclick = () => {
this.$refs.fieldEditor.dropDownVisible = false //
}
})
}, 100)
},
}
}

View File

@ -498,7 +498,7 @@ export default {
*/
loadOptions(options) {
this.field.options.optionItems = deepClone(options)
this.clearSelectedOptions() //清空已选选项
//this.clearSelectedOptions() //清空已选选项
},
/**

View File

@ -0,0 +1,23 @@
<template>
<el-form-item :label="i18nt('designer.setting.checkStrictly')">
<el-checkbox v-model="optionModel.checkStrictly"></el-checkbox>
</el-form-item>
</template>
<script>
import i18n from "@/utils/i18n"
export default {
name: "checkStrictly-editor",
mixins: [i18n],
props: {
designer: Object,
selectedWidget: Object,
optionModel: Object,
},
}
</script>
<style scoped>
</style>

View File

@ -39,6 +39,7 @@ const COMMON_PROPERTIES = {
'allowCreate' : 'allowCreate-editor',
'remote' : 'remote-editor',
'automaticDropdown' : 'automaticDropdown-editor',
'checkStrictly' : 'checkStrictly-editor',
'multiple' : 'multiple-editor',
'multipleLimit' : 'multipleLimit-editor',
'contentPosition' : 'contentPosition-editor',

View File

@ -869,6 +869,7 @@ export const advancedFields = [
hidden: false,
clearable: true,
filterable: false,
checkStrictly: false, //可选择任意一级选项,默认不开启
optionItems: [
{label: 'select 1', value: 1, children: [{label: 'child 1', value: 11}]},
{label: 'select 2', value: 2},

View File

@ -206,6 +206,7 @@ export default {
automaticDropdown: 'Automatic Dropdown',
multiple: 'Multiple',
multipleLimit: 'Multiple Limit',
checkStrictly: 'Any Level Selectable',
contentPosition: 'Content Position',
plain: 'Plain',
round: 'Round',

View File

@ -206,6 +206,7 @@ export default {
automaticDropdown: '自动弹出选项',
multiple: '选项可多选',
multipleLimit: '多选数量限制',
checkStrictly: '任意级节点可选',
contentPosition: '文字位置',
plain: '朴素按钮',
round: '圆角按钮',