sách gpt4 ai đã đi

Vuetify: Cách thực hiện tìm kiếm v-select trong mảng các mảng

In lại 作者:行者123 更新时间:2023-12-04 08:04:35 32 4
mua khóa gpt4 Nike

我正在尝试使用来自我的 API 的 v-select thực hiện tùy chọn,我将数据放在数组数组中。
Array which I got from API
它应该是一个带有搜索的 lựa chọn,因为它的数据太多。
Đây là mã của tôi:


:items="categoriasProduto"
v-model="dadosProduto.id_marca"
item-text="nome"
item-value="id"
label="Marca"
>
脚本:
mounted() {
const url = process.env.VUE_APP_API_URL;
axios
.get(`${url}marcas/`)
.then((response) => {
this.marcas = response.data;
console.log(this.marcas);
});
},
有没有办法让它在 Vue 中工作?

1 Câu trả lời

如果你想包括搜索使用 v-autocomplete .要遍历列表,请使用 .flat :

new Vue({
el:"#app",
vuetify: new Vuetify(),
data: () => ({
categoriasProduto: [
[
{ id:1, id_simplus:'1', nome:'nome 1' },
{ id:2, id_simplus:'2', nome:'nome 2' },
],
[
{ id:3, id_simplus:'3', nome:'nome 3' },
{ id:4, id_simplus:'4', nome:'nome 4' },
]
],
dadosProduto: { id_marca: null }
}),
});






{{dadosProduto.id_marca}}
<>
:items="categoriasProduto.flat()"
v-model="dadosProduto.id_marca"
item-text="nome"
item-value="id"
label="Marca"
>

关于arrays - Vuetify : How to do a v-select search in array of arrays,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66284846/

32 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com