如何禁用/避免错误“ Vuejs道具至少应定义其类型”?

时间:2018-12-06 14:32:24

标签: vue.js vuejs2 eslint vuetify.js lint

我收到警告,例如“道具至少应该定义其类型?require-prop-types”

<script>

export default {

    props: ['Age', 'Name'],

    created(){
      ....
    },  
    ....

 }
</script>

1 个答案:

答案 0 :(得分:-1)

为避免警告

解决方案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
 }