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] onChange 事件会重复触发且文档类型不正确 #1086

Closed
Kigoal opened this issue Sep 14, 2023 · 2 comments · Fixed by #1096
Closed

[Cascader] onChange 事件会重复触发且文档类型不正确 #1086

Kigoal opened this issue Sep 14, 2023 · 2 comments · Fixed by #1096
Labels
bug Something isn't working issueshoot 代码共建平台 middle 中等问题

Comments

@Kigoal
Copy link

Kigoal commented Sep 14, 2023

tdesign-mobile-vue 版本

1.0.3

重现链接

No response

重现步骤

<script setup lang="ts">
const modelValue = defineModel<string | number>({
  required: true,
});

const visible = ref(false);

const handleChange = (_value: string | number, selectedOptions?: TreeOptionData<string | number>[]) => {
  if (selectedOptions) {
    formartModelValue.value = selectedOptions.map((item) => item.label).join(' / ');

    visible.value = false;
  }
};
</script>

<template>
  <TdCascader v-model:visible="visible" v-model="modelValue" :options="options" :title="title" @change="handleChange" />
</template>

期望结果

No response

实际结果

1.实际在每次选完的时候会触发两次,第一次必定是 undefined 类型, 第二次是 TreeOptionData<string | number>[] 类型,非文档的 string[] 类型。
eb419fb9183cb28b867d332202d00fc

2.在没有 props.titlet-cascader__title 样式的高度为 0 ,导致 t-cascader__close-btn 样式显示错位。
image

3.v-modelv-model:value 只会使用初始值,后面值有更新时不会触发响应式

框架版本

No response

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

No response

IssueShoot

  • 预估时长: 3
  • 期望完成时间: 2023-09-22 00:00:00 +0000 UTC
  • 开发难度: 中
  • 参与人数: 1
  • 验收标准: 实现期望改造效果,提 PR 并通过验收无误
  • 备注: 最终激励以实际提交 pull request 并合并为准
@github-actions
Copy link
Contributor

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

@Kigoal Kigoal changed the title [Cascader] onChange 事件会触发重发且文档类型不正确 [Cascader] onChange 事件会重复触发且文档类型不正确 Sep 14, 2023
@anlyyao anlyyao added bug Something isn't working easy 简单问题 issueshoot 代码共建平台 middle 中等问题 and removed easy 简单问题 labels Sep 14, 2023
@bitjian
Copy link
Contributor

bitjian commented Sep 15, 2023

i look look

bitjian added a commit to bitjian/tdesign-mobile-vue that referenced this issue Sep 15, 2023
…有响应式问题

Tencent#1086 fix(cascader): 修复变更选项触发两次onchange事件和v-model绑定ref()没有响应式问题
bitjian added a commit to bitjian/tdesign-mobile-vue that referenced this issue Sep 18, 2023
fix(cascader): 修复变更选项触发两次onchange事件和v-model绑定ref()没有响应式问题 Tencent#1086
anlyyao pushed a commit that referenced this issue Sep 25, 2023
* fix: fix(cascader): 修复变更选项触发两次onchange事件和v-model绑定ref()没有响应式问题

fix(cascader): 修复变更选项触发两次onchange事件和v-model绑定ref()没有响应式问题 #1086

* fix: fix(cascader): 修复变更选项触发两次onchange事件和v-model绑定ref()没有响应式问题

fix(cascader): 修复变更选项触发两次onchange事件和v-model绑定ref()没有响应式问题

* fix: fix(cascader): 修复变更选项触发两次onchange事件和v-model绑定ref()没有响应式问 题

fix(cascader): 修复变更选项触发两次onchange事件和v-model绑定ref()没有响应式问 题
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working issueshoot 代码共建平台 middle 中等问题
Projects
None yet
3 participants