Appearance
vue/no-deprecated-model-definition
禁止弃用的
model
定义(在 Vue.js 3.0.0+ 中)
- ⚙️ 此规则包含在
"plugin:vue/essential"
、*.configs["flat/essential"]
、"plugin:vue/strongly-recommended"
、*.configs["flat/strongly-recommended"]
、"plugin:vue/recommended"
和*.configs["flat/recommended"]
中。
💡此规则报告的某些问题可以通过编辑器 suggestions 手动修复。
¥💡 Some problems reported by this rule are manually fixable by editor suggestions.
📖 规则详情
此规则报告组件 model
选项的使用情况,该选项在 Vue.js 3.0.0+ 中已弃用。
¥This rule reports use of the component model
option, which has been deprecated in Vue.js 3.0.0+.
有关更多详细信息,请参阅 迁移指南 – v-model
。
¥See Migration Guide – v-model
for more details.
🔧选项
¥🔧 Options
json
{
"vue/no-deprecated-model-definition": ["error", {
"allowVue3Compat": true
}]
}
"allowVue3Compat": true
允许 model
定义具有与 Vue.js 3.0.0+ v-model
语法匹配的 prop/event 名称,即 modelValue
/update:modelValue
或 model-value
/update:model-value
。
¥Allow model
definitions with prop/event names that match the Vue.js 3.0.0+ v-model
syntax, i.e. modelValue
/update:modelValue
or model-value
/update:model-value
.
👫相关规则
¥👫 Related Rules
vue/valid-model-definition(适用于 Vue.js 2.x)
¥vue/valid-model-definition (for Vue.js 2.x)
vue/no-v-model-argument(适用于 Vue.js 2.x)
¥vue/no-v-model-argument (for Vue.js 2.x)
📚扩展阅读
¥📚 Further Reading
🚀版本
¥🚀 Version
此规则在 eslint-plugin-vue v9.16.0 中引入
¥This rule was introduced in eslint-plugin-vue v9.16.0
🔍代码实现
¥🔍 Implementation