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

[DropdownItem] 组件不受控 #1139

Closed
gushisan opened this issue Oct 23, 2023 · 2 comments · Fixed by #1145
Closed

[DropdownItem] 组件不受控 #1139

gushisan opened this issue Oct 23, 2023 · 2 comments · Fixed by #1145
Labels
bug Something isn't working easy 简单问题 issueshoot 代码共建平台

Comments

@gushisan
Copy link

gushisan commented Oct 23, 2023

tdesign-mobile-vue 版本

1.0.5

重现链接

No response

重现步骤

<template>
  <t-dropdown-menu>
    <t-dropdown-item :options="options" :value="value" @change="handleChange" />
  </t-dropdown-menu>
  <button @click="handleClick">点我</button>
</template>

<script setup lang="ts">
import { ref } from 'vue';
const options = ref([
  { label: '选项一', value: 1 },
  { label: '选项二', value: 2 },
]);
const value = ref(1);
const handleChange = (val: number) => {
  value.value = val;
};
const handleClick = () => {
  // 动态更改为选项2 实际显示存在问题
  value.value = 2;
};
</script>

复现demo 动态设置t-dropdown-item值时显示错误

期望结果

组件正常受控

实际结果

组件受控异常

框架版本

Vue(3.3.4)

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

No response

IssueShoot

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

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

@fennghuang
Copy link
Collaborator

@gushisan 感谢反馈。外部改变 value 后,dropdown 标题没有变化。

@anlyyao anlyyao added bug Something isn't working easy 简单问题 issueshoot 代码共建平台 labels Oct 25, 2023
yiqia added a commit to yiqia/tdesign-mobile-vue that referenced this issue Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working easy 简单问题 issueshoot 代码共建平台
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants