gpt4 book ai didi

vuejs2 - v-on :keyup not firing function

转载 作者:行者123 更新时间:2023-12-01 16:18:35 24 4
gpt4 key购买 nike

由于某种原因,我无法触发我的 keyup 事件。我希望它在尝试创建实时搜索功能时收听任何和所有 keyup 事件

这是我的代码:

<template>
...
<b-form-input id="search"
v-model="query"
type="text"
placeholder="Search"
v-on:keyup="find(search, query)">
</b-form-input>

....

</template>

<script type="text/javascript">
export default {
data() {
return {
options: [
{ text: 'All', value: 'All' },
{ text: 'Members', value: 'Members' },
{ text: 'Groups', value: 'Groups' },
{ text: 'Events', value: 'Events' }
],
search: 'All',
query: '',
results: []
}
},

methods: {
find: function (param = 'All', string = '') {
axios.get('/api/search/' + param.toLowerCase() + '?query=' + string)
.then(({data}) => {
this.results = data.data;
});
}
}}
</script>

我只能执行 v-on:change 来启动它。

最佳答案

b-form-input仅支持 inputchange事件。

要使用 keyup 事件监听器,添加 .native到它。

@keyup.native="..."

来自 https://bootstrap-vue.js.org/docs/components/form-input#component-reference

enter image description here

关于vuejs2 - v-on :keyup not firing function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49961625/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com