gpt4 book ai didi

javascript - 如何从 Javascript 中的 vuetify 多选 v-autocomplete 中选择(复选框)一个值?

转载 作者:行者123 更新时间:2023-11-29 22:48:28 28 4
gpt4 key购买 nike

我有一个来自 vuetify.js 的多选 v-autocomplete 组件,这些项目是一个在多选下拉列表中使用的数组

defendantCodeOptions 项目看起来像这样

{text: "some text", value: 36}

我似乎无法弄清楚如何在 javascript 中选择从 ajax 调用返回的项目。

<v-autocomplete 
v-model = "defendantCode"
label = "Defendant Code"
:items = "defendantCodeOptions"
:loading = "defendantCodeIsLoading"
:filter = "customFilter"
clearable
multiple
dense >
</v-autocomplete>

例如。我想像下面这样循环遍历 ajax 调用响应中的每个项目,并将下拉列表中的每个选中值设置为与服务器中的值匹配的值。但是下面这个不起作用!

// returned values from ajax call
what I want is something like this
for (var i = 0; i < all items; i++) {
// if the value of this item exists in any of the returned values, check it
}

我希望它看起来像这样使用代码隐藏而不是 UI

enter image description here

最佳答案

这是正确答案。

this.defendantCode = [3, 4]

关于javascript - 如何从 Javascript 中的 vuetify 多选 v-autocomplete 中选择(复选框)一个值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57914770/

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