Skip to content

Commit 9df9281

Browse files
committed
feat: use for vapor
1 parent 8b7a035 commit 9df9281

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

Diff for: packages/compiler-vapor/__tests__/transforms/__snapshots__/vModel.spec.ts.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`compiler: vModel transform > component > v-model for component should generate modelModifiers 1`] = `
3+
exports[`compiler: vModel transform > component > v-model for component should generate modelValueModifiers 1`] = `
44
"import { resolveComponent as _resolveComponent, createComponentWithFallback as _createComponentWithFallback } from 'vue';
55
66
export function render(_ctx) {
77
const _component_Comp = _resolveComponent("Comp")
88
const n0 = _createComponentWithFallback(_component_Comp, { modelValue: () => (_ctx.foo),
99
"onUpdate:modelValue": () => _value => (_ctx.foo = _value),
10-
modelModifiers: () => ({ trim: true, "bar-baz": true }) }, null, true)
10+
modelValueModifiers: () => ({ trim: true, "bar-baz": true }) }, null, true)
1111
return n0
1212
}"
1313
`;

Diff for: packages/compiler-vapor/__tests__/transforms/vModel.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,13 @@ describe('compiler: vModel transform', () => {
266266
})
267267
})
268268

269-
test('v-model for component should generate modelModifiers', () => {
269+
test('v-model for component should generate modelValueModifiers', () => {
270270
const { code, ir } = compileWithVModel(
271271
'<Comp v-model.trim.bar-baz="foo" />',
272272
)
273273
expect(code).toMatchSnapshot()
274274
expect(code).contain(
275-
`modelModifiers: () => ({ trim: true, "bar-baz": true })`,
275+
`modelValueModifiers: () => ({ trim: true, "bar-baz": true })`,
276276
)
277277
expect(ir.block.dynamic.children[0].operation).toMatchObject({
278278
type: IRNodeTypes.CREATE_COMPONENT_NODE,

Diff for: packages/compiler-vapor/src/generators/component.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,7 @@ function genModelModifiers(
240240
if (!modelModifiers || !modelModifiers.length) return []
241241

242242
const modifiersKey = key.isStatic
243-
? key.content === 'modelValue'
244-
? [`modelModifiers`]
245-
: [`${key.content}Modifiers`]
243+
? [`${key.content}Modifiers`]
246244
: ['[', ...genExpression(key, context), ' + "Modifiers"]']
247245

248246
const modifiersVal = genDirectiveModifiers(modelModifiers)

Diff for: packages/runtime-vapor/__tests__/componentEmits.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ describe('component: emit', () => {
265265
const fn2 = vi.fn()
266266
render({
267267
modelValue: () => null,
268-
modelModifiers: () => ({ number: true }),
268+
modelValueModifiers: () => ({ number: true }),
269269
['onUpdate:modelValue']: () => fn1,
270270
foo: () => null,
271271
fooModifiers: () => ({ number: true }),
@@ -291,7 +291,7 @@ describe('component: emit', () => {
291291
modelValue() {
292292
return null
293293
},
294-
modelModifiers() {
294+
modelValueModifiers() {
295295
return { trim: true }
296296
},
297297
['onUpdate:modelValue']() {
@@ -327,7 +327,7 @@ describe('component: emit', () => {
327327
modelValue() {
328328
return null
329329
},
330-
modelModifiers() {
330+
modelValueModifiers() {
331331
return { trim: true, number: true }
332332
},
333333
['onUpdate:modelValue']() {
@@ -361,7 +361,7 @@ describe('component: emit', () => {
361361
modelValue() {
362362
return null
363363
},
364-
modelModifiers() {
364+
modelValueModifiers() {
365365
return { trim: true }
366366
},
367367
['onUpdate:modelValue']() {

0 commit comments

Comments
 (0)