【发布时间】:2019-12-31 15:24:53
【问题描述】:
我正在使用 vuex 和 vuetify,所以我想用我的服务器中的项目做一个下拉列表。 我得到一个 Json 对象,它从我的商店作为对象数组返回。 我使用 getter 在我的组件中访问它,它看起来很好,除了下拉列表呈现不止一次(目前在我的组件中超过 20 次)。如何让我的下拉列表只渲染一次?
<template>
<v-select v-for"item in allItems" :key="item.name"
:items="allItems" item-value="id" item-text="name">
{{item}}</v-select
</template>
<script>
computed: {
allItems(){
return this.$store.getters['items'];
}
}
</script>
一切都在编译,但我真的不需要多个下拉列表。我做错了什么?
【问题讨论】:
标签: vue.js components vuex vuetify.js