【发布时间】:2021-05-22 20:58:42
【问题描述】:
我正在尝试使用来自我的 API 的 options 执行 v-select,我将数据保存在数组数组中。
Array which I got from API
它应该是带有搜索的select,因为它的数据太多。
这是我的代码:
<v-select
:items="categoriasProduto"
v-model="dadosProduto.id_marca"
item-text="nome"
item-value="id"
label="Marca"
></v-select>
脚本:
mounted() {
const url = process.env.VUE_APP_API_URL;
axios
.get(`${url}marcas/`)
.then((response) => {
this.marcas = response.data;
console.log(this.marcas);
});
},
有没有办法让它在Vue中工作?
【问题讨论】:
-
请提供阅读How to ask 和Minimal, reproducible example。没有足够的信息,就几乎没有机会有意义地回答您的问题。顺便说一句 - 是的。如果在 JavaScript 中可以,那么在 Vue 中也可以。
标签: arrays vue.js vuetify.js