Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cascader] keys中加入disabled的自定义字段判定 #3193

Closed
puppetsheep opened this issue Aug 4, 2023 · 15 comments
Closed

[Cascader] keys中加入disabled的自定义字段判定 #3193

puppetsheep opened this issue Aug 4, 2023 · 15 comments
Assignees
Labels
to be published to be published

Comments

@puppetsheep
Copy link

这个功能解决了什么问题

能自自定义哪个字段会被判定为disabled,用来控制禁用项

你建议的方案是什么

<t-cascader v-model="value" :options="options" clearable :keys="{ disabled:'disable' }" @change="onChange" />
@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2023

👋 @puppetsheep,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2023

♥️ 有劳 @PengYYYYY 尽快确认问题。
确认有效后将下一步计划和可能需要的时间回复给 @puppetsheep

@AuYuHui
Copy link
Contributor

AuYuHui commented Aug 4, 2023

你可以 在节点 中 设置 disabled为 true 禁用节点

{
    label: '选项一',
    value: '1',
    children: [
      {
        label: '子选项一',
        value: '1.1',
        disabled: true,
      },
      {
        label: '子选项二',
        value: '1.2',
      },
      {
        label: '子选项三',
        value: '1.3',
      },
    ],
  }

@puppetsheep
Copy link
Author

不一定会有disabled字段,或者需要通过动态判定disabled所使用的字段时,操作起来就极为复杂。

@PengYYYYY
Copy link
Collaborator

这种自己处理一下数据结构就好了

@PengYYYYY
Copy link
Collaborator

PengYYYYY commented Aug 4, 2023

暂时不考虑增加这样的特性,有点奇怪。这个需求很业务了。

@puppetsheep
Copy link
Author

当前所有主流的vue3组件库都支持这个操作,应该不算很业务的需求了吧?

@AuYuHui
Copy link
Contributor

AuYuHui commented Aug 4, 2023

当前所有主流的vue3组件库都支持这个操作,应该不算很业务的需求了吧?
哪个?

@AuYuHui
Copy link
Contributor

AuYuHui commented Aug 4, 2023

都不是说 :keys="{ disabled:'disable' }" 以这种方式来 禁用选项的,你要禁用哪个 自己 控制 对应的 option 就好了

@puppetsheep
Copy link
Author

都允许指定某字段或判定disabled的条件,例如Arco中可以直接设置

 <a-cascader
      :options="allDeptList"
      :field-names="{
        value: 'id',
        label: 'title',
        children: 'children',
        disabled: 'disable',
      }"
    />

@AuYuHui
Copy link
Contributor

AuYuHui commented Aug 4, 2023

都允许指定某字段或判定disabled的条件,例如Arco中可以直接设置

 <a-cascader
      :options="allDeptList"
      :field-names="{
        value: 'id',
        label: 'title',
        children: 'children',
        disabled: 'disable',
      }"
    />

那你可以 自己 fork一下代码 改

@puppetsheep
Copy link
Author

#3060
#2258
都是相关问题

@chaishi chaishi reopened this Aug 4, 2023
@chaishi
Copy link
Collaborator

chaishi commented Aug 4, 2023

经过讨论,最终予以支持。keys 可以用来扩展支持所有场景的字段别名

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to be published to be published
Projects
None yet
Development

No branches or pull requests

5 participants