1

在我的 Laravel 5.8 / vuejs 2.6 应用程序中,使用 "vue-select": "^2.6.4" 我
在选择选项时设置了操作,但我有 2 个问题:1)看起来在打开的页面上触发了操作 2)当我选择选项动作被触发两次。3)我试图设置 .prevent :

<v-select
    v-model="selection_forum_post_action"
    :options="forumPostActionValueArray"
    id="forum_post_action"
    name="forum_post_action"
    class="form-control editable_field"
    placeholder="Select action"
    @change.prevent="forumPostActionSelected(nextThreadPost.id, nextThreadPost.body, nextThreadPost.creator_name)"
></v-select>

但得到控制台错误:

app.js?dt=1571398092:134128 [Vue warn]: Error in v-on handler: "TypeError: $event.preventDefault is not a function"                               

我尝试了几种变体,但都失败了。请工作示例...

4

1 回答 1

1

我发现@input 对我很有用:

<v-select
    v-model="selection_forum_post_action"
    :options="forumPostActionValueArray"
    id="forum_post_action"
    name="forum_post_action"
    class="form-control editable_field"
   placeholder="Select action"
   @input="forumPostActionSelected(nextThreadPost.id, nextThreadPost.body, nextThreadPost.creator_name)"
></v-select>
于 2019-10-20T10:36:43.210 回答