Skip to content

Commit d333a49

Browse files
committed
simplify v-model assignment gen + support adding reactive field when using dynamic segments
1 parent 7f7bf91 commit d333a49

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Diff for: src/compiler/directives/model.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ export function genAssignmentCode (
4141
if (modelRs.idx === null) {
4242
return `${value}=${assignment}`
4343
} else {
44-
return `var $$exp = ${modelRs.exp}, $$idx = ${modelRs.idx};` +
45-
`if (!Array.isArray($$exp)){` +
46-
`${value}=${assignment}}` +
47-
`else{$$exp.splice($$idx, 1, ${assignment})}`
44+
return `$set(${modelRs.exp}, ${modelRs.idx}, ${assignment})`
4845
}
4946
}
5047

0 commit comments

Comments
 (0)