Skip to content

vue/require-default-prop ​

要求 props 有默认值

  • ⚙️ 此规则包含在 "plugin:vue/strongly-recommended"、*.configs["flat/strongly-recommended"]、"plugin:vue/vue2-strongly-recommended"、*.configs["flat/vue2-strongly-recommended"]、"plugin:vue/recommended"、*.configs["flat/recommended"]、"plugin:vue/vue2-recommended" 和 *.configs["flat/vue2-recommended"] 中。

📖 规则详情 ​

此规则要求为每个未标记为 required 的 props(Boolean props 除外)设置默认值。

¥This rule requires default value to be set for each props that are not marked as required (except Boolean props).

Now loading...

🔧选项 ​

¥🔧 Options

无。

¥Nothing.

👫相关规则 ​

¥👫 Related Rules

📚扩展阅读 ​

¥📚 Further Reading

🚀版本 ​

¥🚀 Version

此规则在 eslint-plugin-vue v3.13.0 中引入

¥This rule was introduced in eslint-plugin-vue v3.13.0

🔍代码实现 ​

¥🔍 Implementation

eslint-plugin-vue v10.4 中文网 - 粤ICP备13048890号