Vue.js “如何阻止/避免错误”;Vuejs道具至少应该定义它们的类型;?
我收到了eslint警告,比如“道具至少应该定义它们的类型?需要道具类型”Vue.js “如何阻止/避免错误”;Vuejs道具至少应该定义它们的类型;?,vue.js,vuejs2,eslint,vuetify.js,lint,Vue.js,Vuejs2,Eslint,Vuetify.js,Lint,我收到了eslint警告,比如“道具至少应该定义它们的类型?需要道具类型” 导出默认值{ 道具:['Age','Name'], 创建(){ .... }, .... } 以避免警告 解决方案1: props: { Age: { type: Number, }, Name: { type: String }, 要禁用警告,请执行以下操作: 解决方案2: 在.eslintrc.js或.eslintrc.*或.eslintrc.json文
导出默认值{
道具:['Age','Name'],
创建(){
....
},
....
}
以避免警告
解决方案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
}
.eslintrc.js or .eslintrc.* or .eslintrc.json file
rules: {
//....add your existing rules and below line as well
"vue/require-prop-types":0
}