fix(compiler-vapor): v-model argument on native element

This commit is contained in:
三咲智子 Kevin Deng 2024-04-19 01:13:05 +08:00
parent 75488653d3
commit af1581be28
No known key found for this signature in database
2 changed files with 2 additions and 3 deletions

View File

@ -91,8 +91,7 @@ describe('compiler: vModel transform', () => {
) )
}) })
// TODO: component test('plain elements with argument', () => {
test.fails('plain elements with argument', () => {
const onError = vi.fn() const onError = vi.fn()
compileWithVModel('<input v-model:value="model" />', { onError }) compileWithVModel('<input v-model:value="model" />', { onError })

View File

@ -65,6 +65,7 @@ export const transformVModel: DirectiveTransform = (dir, node, context) => {
let runtimeDirective: VaporHelper | undefined let runtimeDirective: VaporHelper | undefined
if (isComponent) { if (isComponent) {
} else {
if (dir.arg) if (dir.arg)
context.options.onError( context.options.onError(
createDOMCompilerError( createDOMCompilerError(
@ -72,7 +73,6 @@ export const transformVModel: DirectiveTransform = (dir, node, context) => {
dir.arg.loc, dir.arg.loc,
), ),
) )
} else {
const { tag } = node const { tag } = node
const isCustomElement = context.options.isCustomElement(tag) const isCustomElement = context.options.isCustomElement(tag)
runtimeDirective = 'vModelText' runtimeDirective = 'vModelText'