了解如何避免在VueJS中使用vue / require-prop-type-constructor警告

时间:2018-12-14 05:56:06

标签: vue.js

我正在控制带有布尔变量isTabsEnabled的Tabview来切换标签的显示。该道具作为子项传递给使用它的屏幕,这是父文件,

export{
  props:{
    isTabsEnabled: true
  }
}

ESLint引发错误vue/require-prop-type-constructor,我尝试使用propsData,这删除了警告消息,但是功能中断。

关于如何避免此警告的任何建议?

1 个答案:

答案 0 :(得分:1)

您需要指定道具类型:

props: {
  isTabsEnabled: {
    type: Boolean,
    default: true
  }
}