Appearance
vue/valid-v-bind-sync
在
v-bind
指令上强制使用有效的.sync
修饰符
- 🚫 此规则已弃用。
⚙️此规则包含在
"plugin:vue/vue2-essential"
、*.configs["flat/vue2-essential"]
、"plugin:vue/vue2-strongly-recommended"
、*.configs["flat/vue2-strongly-recommended"]
、"plugin:vue/vue2-recommended"
和*.configs["flat/vue2-recommended"]
中。¥⚙️ This rule is included in all of
"plugin:vue/vue2-essential"
,*.configs["flat/vue2-essential"]
,"plugin:vue/vue2-strongly-recommended"
,*.configs["flat/vue2-strongly-recommended"]
,"plugin:vue/vue2-recommended"
and*.configs["flat/vue2-recommended"]
.
此规则检查 v-bind
指令上的每个 .sync
修饰符是否有效。
¥This rule checks whether every .sync
modifier on v-bind
directives is valid.
📖 规则详情
此规则在以下情况下报告 v-bind
指令上的 .sync
修饰符:
¥This rule reports .sync
modifier on v-bind
directives in the following cases:
.sync
修饰符没有作为 LHS 有效的属性值。例如<MyComponent v-bind:aaa.sync="foo() + bar()" />
,<MyComponent v-bind:aaa.sync="a?.b" />
¥The
.sync
modifier does not have the attribute value which is valid as LHS. E.g.<MyComponent v-bind:aaa.sync="foo() + bar()" />
,<MyComponent v-bind:aaa.sync="a?.b" />
.sync
修饰符具有潜在的空对象属性访问。例如<MyComponent v-bind:aaa.sync="(a?.b).c" />
¥The
.sync
modifier has potential null object property access. E.g.<MyComponent v-bind:aaa.sync="(a?.b).c" />
.sync
修饰符在非 Vue 组件上。例如<input v-bind:aaa.sync="foo"></div>
¥The
.sync
modifier is on non Vue-components. E.g.<input v-bind:aaa.sync="foo"></div>
.sync
修饰符的引用是迭代变量。例如<div v-for="x in list"><MyComponent v-bind:aaa.sync="x" /></div>
¥The
.sync
modifier's reference is iteration variables. E.g.<div v-for="x in list"><MyComponent v-bind:aaa.sync="x" /></div>
注意
此规则不检查指令中的语法错误,因为它由 vue/no-parsing-error 规则检查。
¥This rule does not check syntax errors in directives because it's checked by vue/no-parsing-error rule.
🔧选项
¥🔧 Options
无。
¥Nothing.
👫相关规则
¥👫 Related Rules
📚扩展阅读
¥📚 Further Reading
🚀版本
¥🚀 Version
此规则在 eslint-plugin-vue v7.0.0 中引入
¥This rule was introduced in eslint-plugin-vue v7.0.0
🔍代码实现
¥🔍 Implementation