-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Input.Search 事件在点击清除图标删除内容时也会触发 #3511
Comments
check ant-design/ant-design#18729 |
不是哦,是清除之前的值。我倒是想要他是空字符串啊。我用的是vue3组合式api。如果您方便的话我可以给你远程 |
我现在解决是解决了,不过这样解决也太low了吧。给您看看我的解决方案:
解决后的代码:
等于是我查询代码必须得用nextTick才行,对于我这种有代码洁癖的人来说简直不能忍啊!!! |
您再看下,我重现了 |
我贴代码给你,你那个太高级了我不会用。
|
在onSearch的回调中使用value
|
能否让我能像我那样写,你们框架层面能解决吗? |
@ajuner 这个内部改成 先触发 change update:value 再触发 search 就可以满足他的写法了 |
可以先这样用 <template>
<div>
<a-input-search
v-model:value="value"
placeholder="input search text"
style="width: 200px"
@search="onSearch"
:allowClear="true"
/>
</div>
</template>
<script>
import { ref } from "vue";
export default {
setup() {
const searchText = ref("123");
function onSearch(value) {
userController
.getList({
quickText: value,
pageNum: currentPage,
pageSize: pagination.pageSize,
})
.then((p) => {
//显示查询表格代码
});
}
return {
value: searchText,
onSearch,
};
},
};
</script> |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Version
2.0.0-rc.8
Environment
windows10,new Chrome,vue 3.0.4
Reproduction link
https://2x.antdv.com/components/input-cn/#Input.Search-%E4%BA%8B%E4%BB%B6
Steps to reproduce
a-input-search组件的:allowClear="true",然后绑定事件@search,当点击清除图标会触发一次事件。我使用的vue3的组合式api。
What is expected?
触发也行,不过要带过来清除后的值。现在给我带过来的清除前的值,导致我的查询现象很怪异,说白了就是bug。
What is actually happening?
点击清除会触发事件,v-model:value绑定过来的值是清除之前的值。
检查其他可能与这个相似的bug。
The text was updated successfully, but these errors were encountered: