refactor(compiler): remove modelValue from generated code for native v-model

This commit is contained in:
Evan You
2020-03-16 17:51:56 -04:00
parent 3b2d236714
commit 9eef37fa32
3 changed files with 34 additions and 35 deletions

View File

@@ -104,5 +104,17 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
)
}
// native vmodel doesn't need the `modelValue` props since they are also
// passed to the runtime as `binding.value`. removing it reduces code size.
baseResult.props = baseResult.props.filter(p => {
if (
p.key.type === NodeTypes.SIMPLE_EXPRESSION &&
p.key.content === 'modelValue'
) {
return false
}
return true
})
return baseResult
}