const { openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock(\\"input\\", {
- value: model,
- \\"onUpdate:value\\": $event => ((model) = $event)
- }, null, 40 /* PROPS, HYDRATE_EVENTS */, [\\"value\\", \\"onUpdate:value\\"]))
+ \\"foo-value\\": model,
+ \\"onUpdate:fooValue\\": $event => ((model) = $event)
+ }, null, 40 /* PROPS, HYDRATE_EVENTS */, [\\"foo-value\\", \\"onUpdate:fooValue\\"]))
}
}"
`;
})
test('with argument', () => {
- const root = parseWithVModel('<input v-model:value="model" />')
+ const root = parseWithVModel('<input v-model:foo-value="model" />')
const node = root.children[0] as ElementNode
const props = ((node.codegenNode as VNodeCall).props as ObjectExpression)
.properties
expect(props[0]).toMatchObject({
key: {
- content: 'value',
+ content: 'foo-value',
isStatic: true
},
value: {
expect(props[1]).toMatchObject({
key: {
- content: 'onUpdate:value',
+ content: 'onUpdate:fooValue',
isStatic: true
},
value: {
} from '../utils'
import { IS_REF } from '../runtimeHelpers'
import { BindingTypes } from '../options'
+import { camelize } from '@vue/shared'
export const transformModel: DirectiveTransform = (dir, node, context) => {
const { exp, arg } = dir
const propName = arg ? arg : createSimpleExpression('modelValue', true)
const eventName = arg
? isStaticExp(arg)
- ? `onUpdate:${arg.content}`
+ ? `onUpdate:${camelize(arg.content)}`
: createCompoundExpression(['"onUpdate:" + ', arg])
: `onUpdate:modelValue`