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

[TagInput] 透传inputProps中onChange事件报错 #4802

Open
entireyu opened this issue Dec 2, 2024 · 3 comments
Open

[TagInput] 透传inputProps中onChange事件报错 #4802

entireyu opened this issue Dec 2, 2024 · 3 comments
Labels
🐞 bug Something isn't working

Comments

@entireyu
Copy link

entireyu commented Dec 2, 2024

tdesign-vue-next 版本

1.10.4

重现链接

https://codesandbox.io/p/sandbox/tdesign-vue-next-tag-input-max-demo-forked-d7ljpx

重现步骤

<template>
  <t-tag-input v-model="tags" placeholder="最多只能输入 3 个标签" :max="3" :inputProps="{
    onChange: handleOnChange
  }" @enter="onEnter" />
</template>

<script setup>
import { ref } from 'vue';
import { MessagePlugin } from 'tdesign-vue-next';

const tags = ref([]);
const onEnter = (value, { inputValue }) => {
  if (value.length >= 3 && inputValue) {
    MessagePlugin.warning('最多只能输入 3 个标签!');
  }
};
function handleOnChange(value){
  console.log(value)
}
</script>

期望结果

获取到输入框的输入内容

实际结果

image
image

框架版本

No response

浏览器版本

No response

系统版本

No response

Node版本

20.11.1

补充说明

似乎是因为onChange属性不支持数组导致的。我需要监听用户输入的内容

Copy link
Contributor

github-actions bot commented Dec 2, 2024

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

@entireyu
Copy link
Author

entireyu commented Dec 2, 2024

如果有同样遇到此问题的同学,可以先通过设置v-model:inputValue + watch的形式替代

@entireyu
Copy link
Author

entireyu commented Dec 2, 2024

如果有同样遇到此问题的同学,可以先通过设置v-model:inputValue + watch的形式替代
也可以使用input-change
image

@uyarn uyarn added the 🐞 bug Something isn't working label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants