【问题标题】:How to dissable/Avoid error "Vuejs Props should at least define their types"?如何禁用/避免错误“Vuejs 道具应该至少定义它们的类型”?
【发布时间】:2019-05-08 06:46:58
【问题描述】:

我收到类似“道具应该至少定义它们的类型?需要道具类型”的 eslint 警告

<script>

export default {

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

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

 }
</script>

【问题讨论】:

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


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

    【讨论】:

      猜你喜欢
      • 2019-05-08
      • 2018-08-25
      • 1970-01-01
      • 2018-06-15
      • 2022-08-05
      • 2022-09-22
      • 1970-01-01
      • 2020-06-23
      • 1970-01-01
      相关资源
      最近更新 更多