【发布时间】:2022-10-01 14:41:47
【问题描述】:
我正在为我的项目使用 Vuetify 3.0.0-beta.0 ~(因为它是唯一支持 vue3 的版本),并且有一个有点奇怪的问题
我想实现与https://codepen.io/reijnemans/pen/vYNadMo?editors=1010 中描述的相同的东西,其中涉及 v-select,所以我需要使用 Vuetify
复制sn-p
<v-select
:items=\"items\"
label=\"Standard\"
>
<template v-slot:selection=\"{ item, index }\">
<img :src=\"item.image\">{{ item.name }}</template>
</template>
<template v-slot:item=\"{ item }\">
<img :src=\"item.image\">{{ item.name }}</template>
</v-select>
我的组件:
<template>
<div class=\"resourceSelectors\">
<v-col cols=\"10\" lg=\"4\" class=\"mx-auto\">
<div class=\"text-center\">
<h2 class=\"indigo--text\" style=\"margin-bottom: 30px\">Some Test H2</h2>
</div>
<v-col class=\"d-flex\" cols=\"12\" sm=\"6\">
<v-select
:items=\"items\"
label=\"Standard\">
<template v-slot:selection=\"{ item }\">
<img :src=\"item.image\">{{ item.name }}
</template>
<template v-slot:item=\"{ item }\">
<img :src=\"item.image\">{{ item.name }}
</template>
</v-select>
</v-col>
</v-col>
</div>
</template>
<script>
import { mapState } from \"vuex\";
/* eslint-disable */
export default {
name: \"testComponent\",
data() {
return {
// hardware Configuration Validation Rules
items: [
{ name: \'Foo\', image: \'https://www.gravatar.com/avatar/b17065ea1655f1e3283aac8d8fc16019?s=48&d=identicon&r=PG\'},
{ name: \'Bar\', image: \'https://www.gravatar.com/avatar/b17065ea1655f1e3283aac8d8fc16019?s=48&d=identicon&r=PG\'},
{ name: \'Hoo\', image: \'https://www.gravatar.com/avatar/b17065ea1655f1e3283aac8d8fc16019?s=48&d=identicon&r=PG\'},
{ name: \'Coo\', image: \'https://www.gravatar.com/avatar/b17065ea1655f1e3283aac8d8fc16019?s=48&d=identicon&r=PG\'}],
}
}}
当我尝试运行上述组件时,我总是收到这个奇怪的错误 Failed setting prop \"type\" on <select>: value text is invalid. TypeError: Cannot set property type of #<HTMLSelectElement> which has only a getter,
以前有没有人遇到过类似的问题?
标签: vue.js