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

[Checkbox] 二次封装多选框组件插槽定义选项失效 #940

Closed
uncledrewzhaopeng opened this issue Jun 6, 2022 · 5 comments
Closed
Assignees
Labels
to be published to be published

Comments

@uncledrewzhaopeng
Copy link
Contributor

uncledrewzhaopeng commented Jun 6, 2022

tdesign-vue-next 版本

0.15.2

重现链接

No response

重现步骤

二次封装t-checkbox-group和t-checkbox组件

<template>
  <t-checkbox-group v-bind="$attrs">
    <template v-for="(index, name) in $slots" v-slot:[name]>
      <slot :name="name" />
    </template>
  </t-checkbox-group>
</template>
<template>
  <t-checkbox v-bind="$attrs">
    <template v-for="(index, name) in $slots" v-slot:[name]>
      <slot :name="name" />
    </template>
  </t-checkbox>
</template>

页面中使用

<div>方式:组件内置全选功能,使用插槽定义选项。选中值: {{ value2.join(', ') }}</div>
<hl-checkbox-group v-model="value2" @change="onChange2">
  <hl-checkbox :check-all="true" label="全选" />
  <hl-checkbox value="选项一">选项一</hl-checkbox>
  <hl-checkbox label="选项二" value="选项二" />
  <hl-checkbox label="选项三" value="选项三" />
</hl-checkbox-group>
const value2 = ref(['选项一'])
const onChange2 = (val) => {
  console.log(value2.value, val)
}

问题

1. 选择其它项的时候,全选按钮没有半选状态
image
image

2. 点击全选的时候,清空了其它的选项,全选按钮没有选中状态且显示选中的为undefined
image
image

期望结果

No response

实际结果

No response

框架版本

No response

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

No response

@github-actions
Copy link
Contributor

github-actions bot commented Jun 6, 2022

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

@github-actions
Copy link
Contributor

github-actions bot commented Jun 6, 2022

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

@uncledrewzhaopeng uncledrewzhaopeng changed the title [Checkbox] 二次封装多选框插槽定义选项失效 [Checkbox] 二次封装多选框组件插槽定义选项失效 Jun 8, 2022
@PengYYYYY
Copy link
Collaborator

会在下个版本修复这个问题,需要注意的是,这个组件需要导出一个组件名为‘xxx-checkbox’,用于父组件识别子组件

<template>
  <t-checkbox v-bind="$attrs">
    <template v-for="(index, name) in $slots" v-slot:[name]>
      <slot :name="name" />
    </template>
  </t-checkbox>
</template>

@PengYYYYY PengYYYYY added the to be published to be published label Jun 11, 2022
@uncledrewzhaopeng
Copy link
Contributor Author

我是封了两个组件(父组件和子组件)
image

@PengYYYYY PengYYYYY mentioned this issue Jun 11, 2022
15 tasks
@github-actions github-actions bot mentioned this issue Jun 13, 2022
4 tasks
@PengYYYYY
Copy link
Collaborator

0.16.0 修复

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

3 participants