【发布时间】:2019-05-08 06:46:58
【问题描述】:
我收到类似“道具应该至少定义它们的类型?需要道具类型”的 eslint 警告
<script>
export default {
props: ['Age', 'Name'],
created(){
....
},
....
}
</script>
【问题讨论】:
标签: vue.js vuejs2 eslint vuetify.js lint
我收到类似“道具应该至少定义它们的类型?需要道具类型”的 eslint 警告
<script>
export default {
props: ['Age', 'Name'],
created(){
....
},
....
}
</script>
【问题讨论】:
标签: vue.js vuejs2 eslint vuetify.js lint
为了避免警告
解决方案 1:
props: {
Age: {
type: Number,
},
Name: {
type: String
},
禁用警告:
解决方案 2:
在 .eslintrc.js 或 .eslintrc.* 或 .eslintrc.json 文件中添加此规则
.eslintrc.js or .eslintrc.* or .eslintrc.json file
rules: {
//....add your existing rules and below line as well
"vue/require-prop-types":0
}
【讨论】: