Skip to content

Commit 01f64ee

Browse files
committed
fix(language-core): remove mapping for v-model
1 parent e779822 commit 01f64ee

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

packages/language-core/lib/codegen/template/elementProps.ts

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,16 @@ export function* generateElementProps(
7676
&& (prop.name === 'model' || prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION)
7777
&& (!prop.exp || prop.exp.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION)
7878
) {
79-
let propName =
80-
prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION
81-
? prop.arg.constType === CompilerDOM.ConstantTypes.CAN_STRINGIFY
82-
? prop.arg.content
83-
: prop.arg.loc.source
84-
: getModelValuePropName(node, options.vueCompilerOptions.target, options.vueCompilerOptions);
79+
let propName: string | undefined;
80+
81+
if (prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) {
82+
propName = prop.arg.constType === CompilerDOM.ConstantTypes.CAN_STRINGIFY
83+
? prop.arg.content
84+
: prop.arg.loc.source;
85+
}
86+
else {
87+
propName = getModelValuePropName(node, options.vueCompilerOptions.target, options.vueCompilerOptions);
88+
}
8589

8690
if (
8791
propName === undefined
@@ -110,26 +114,26 @@ export function* generateElementProps(
110114
prop.loc.start.offset,
111115
prop.loc.end.offset,
112116
ctx.codeFeatures.verification,
113-
...generateObjectProperty(
114-
options,
115-
ctx,
116-
propName,
117-
prop.arg
118-
? prop.arg.loc.start.offset
119-
: prop.loc.start.offset,
117+
...(
120118
prop.arg
121-
? {
122-
...ctx.codeFeatures.withoutHighlightAndCompletion,
123-
navigation: ctx.codeFeatures.withoutHighlightAndCompletion.navigation
124-
? {
125-
resolveRenameNewName: camelize,
126-
resolveRenameEditText: shouldCamelize ? hyphenateAttr : undefined,
127-
}
128-
: false,
129-
}
130-
: ctx.codeFeatures.withoutHighlightAndCompletion,
131-
(prop.loc as any).name_2 ?? ((prop.loc as any).name_2 = {}),
132-
shouldCamelize,
119+
? generateObjectProperty(
120+
options,
121+
ctx,
122+
propName,
123+
prop.arg.loc.start.offset,
124+
{
125+
...ctx.codeFeatures.withoutHighlightAndCompletion,
126+
navigation: ctx.codeFeatures.withoutHighlightAndCompletion.navigation
127+
? {
128+
resolveRenameNewName: camelize,
129+
resolveRenameEditText: shouldCamelize ? hyphenateAttr : undefined,
130+
}
131+
: false,
132+
},
133+
(prop.loc as any).name_2 ?? ((prop.loc as any).name_2 = {}),
134+
shouldCamelize,
135+
)
136+
: [propName]
133137
),
134138
`: (`,
135139
...genereatePropExp(

0 commit comments

Comments
 (0)