Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rules/valid-v-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function create (context) {

for (const reference of node.value.references) {
const id = reference.id
if (id.parent.type === 'MemberExpression') {
if (id.parent.type === 'MemberExpression' || id.parent.type === 'BinaryExpression') {
continue
}

Expand Down
8 changes: 8 additions & 0 deletions tests/lib/rules/valid-v-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ tester.run('valid-v-model', rule, {
{
filename: 'test.vue',
code: '<template><div><div v-for="x in list"><input v-model="x.foo"></div></div></template>'
},
{
filename: 'test.vue',
code: '<template><div><div v-for="x in list"><input v-model="foo[x]"></div></div></template>'
},
{
filename: 'test.vue',
code: '<template><div><div v-for="x in list"><input v-model="foo[x - 1]"></div></div></template>'
}
],
invalid: [
Expand Down