vue.js - Vue无法读取未定义的属性'$refs'
问题描述
我有一个利用Vuetify的Vue应用程序。在此应用程序中,我有一个名为的组件,其设置如下:city-selector.vue
<template>
<select-comp
:id="id"
:items="cityList"
:item-text="name"
:item-value="cityCode"
@input="onInput">
</select-comp>
</template>
<script>
import VSelect from '../vuetify/VSelect';
export default {
name: 'city-select-comp',
extends: VSelect,
props: {
id: {
type: String,
default: '',
},
cityList: {
type: Array,
default: () => { return [] }
},
},
methods: {
onInput() {
//Nothing special, just $emit'ing the event to the parent
},
},
}
</script>
这个组件的一切工作正常,除了当我打开我的开发工具时,我得到一堆控制台错误,都说这个(或类似的东西):
无法读取未定义的属性“$refs”
我该如何修复这片红色的海洋?
解决方案
这是由于您不需要的错误导入。删除import VSelect
和extends
语句,您的控制台错误将消失,如下所示:
<script>
export default {
name: 'city-select-comp',
props: {
id: {
type: String,
default: '',
},
cityList: {
type: Array,
default: () => { return [] }
},
},
methods: {
onInput() {
//Nothing special, just $emit'ing the event to the parent
},
},
}
</script>
推荐阅读
- html - CSS 选择元素,它具有以下元素
- php - WP Crontrol:在您的站点上产生对 WP-Cron 系统的调用时出现问题
- swift - 如何在导航视图控制器中引用当前视图
- vb.net - 如何选择实体列表并获得它们的属性?
- php - PHP将结果循环到数组中
- regex - 如何找到特殊字符 { 和 \ 之间的模式?
- shutdown - 尝试关闭项目时出现 Lien 连接问题
- amazon-web-services - 尝试在 AWS 的巴林(me-south-1)区域设置代码管道
- php - get_post_meta 没有在 Wordpress functions.php 中打印/公开分配的自定义字段
- azure-functions - 如何使用函数应用程序复制 blob 数据并将其存储在子目录中