diff --git a/src/cascader/cascader.en-US.md b/src/cascader/cascader.en-US.md index 8d7306d4b..5fe0241e8 100644 --- a/src/cascader/cascader.en-US.md +++ b/src/cascader/cascader.en-US.md @@ -15,7 +15,6 @@ title | String / Slot / Function | - | Typescript:`string \| TNode`。[see mor value | String / Number | - | `v-model` and `v-model:value` is supported | N defaultValue | String / Number | - | uncontrolled property | N visible | Boolean | false | \- | N -checkStrictly | Boolean | false | \- | N placeholder | String / Slot / Function | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N onChange | Function | | Typescript:`(value: string \| number, selectedOptions: string[]) => void`
| N onClose | Function | | Typescript:`(trigger: TriggerSource) => void`
[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/cascader/type.ts)。
`type TriggerSource = 'overlay' \| 'close-btn' \| 'finish'`
| N diff --git a/src/cascader/cascader.md b/src/cascader/cascader.md index 571d66189..a1909c90a 100644 --- a/src/cascader/cascader.md +++ b/src/cascader/cascader.md @@ -14,7 +14,6 @@ title | String / Slot / Function | - | 标题。TS 类型:`string \| TNode`。 value | String / Number | - | 选项值。支持语法糖 `v-model` 或 `v-model:value` | N defaultValue | String / Number | - | 选项值。非受控属性 | N visible | Boolean | false | 是否展示 | N -checkStrictly | Boolean | false | 父子节点选中状态不再关联,可各自选中或取消 | N placeholder | String / Slot / Function | 选择选项 | 未选中时的提示文案。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N onChange | Function | | TS 类型:`(value: string \| number, selectedOptions: string[]) => void`
值发生变更时触发 | N onClose | Function | | TS 类型:`(trigger: TriggerSource) => void`
关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/cascader/type.ts)。
`type TriggerSource = 'overlay' \| 'close-btn' \| 'finish'`
| N diff --git a/src/cascader/cascader.vue b/src/cascader/cascader.vue index aadadd01a..dfd08b851 100644 --- a/src/cascader/cascader.vue +++ b/src/cascader/cascader.vue @@ -259,25 +259,11 @@ export default defineComponent({ ); const close = (trigger: string) => { - if (props.checkStrictly) onCloseChange(); props.onClose?.({ trigger }); }; - const onVisibleChange = (visible: boolean, e?: any) => { - if (e?.trigger === 'overlay') close('overlay'); - }; - - const onCloseChange = () => { - if (!stepIndex.value) { - setCascaderValue('', []); - } else { - const item = items[stepIndex.value - 1][selectedIndexes[stepIndex.value - 1]]; - - setCascaderValue( - item[(keys as Ref).value?.value ?? 'value'], - items.slice(0, stepIndex.value).map((item, index) => toRaw(item?.[selectedIndexes[index]])), - ); - } + const onVisibleChange = (visible: boolean) => { + close('overlay'); }; const onClose = () => { diff --git a/src/cascader/props.ts b/src/cascader/props.ts index dedacc5be..67c8f6354 100644 --- a/src/cascader/props.ts +++ b/src/cascader/props.ts @@ -59,11 +59,6 @@ export default { }, /** 是否展示 */ visible: Boolean, - /** 父子节点选中状态不再关联,可各自选中或取消 */ - checkStrictly: { - type: Boolean, - default: false, - }, /** 值发生变更时触发 */ onChange: Function as PropType, /** 关闭时触发 */