Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(compiler-vapor): component with dynamic arguments #192

Merged
merged 4 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ exports[`compiler: element transform > component > should wrap as function if v-

export function render(_ctx) {
const _component_Foo = _resolveComponent("Foo")
const n0 = _createComponent(_component_Foo, [{
onBar: () => $event => (_ctx.handleBar($event))
}], true)
const n0 = _createComponent(_component_Foo, [
{ onBar: () => $event => (_ctx.handleBar($event)) }
], true)
return n0
}"
`;
Expand All @@ -112,10 +112,12 @@ exports[`compiler: element transform > component > static props 1`] = `

export function render(_ctx) {
const _component_Foo = _resolveComponent("Foo")
const n0 = _createComponent(_component_Foo, [{
id: () => ("foo"),
class: () => ("bar")
}], true)
const n0 = _createComponent(_component_Foo, [
{
id: () => ("foo"),
class: () => ("bar")
}
], true)
return n0
}"
`;
Expand All @@ -125,7 +127,9 @@ exports[`compiler: element transform > component > v-bind="obj" 1`] = `

export function render(_ctx) {
const _component_Foo = _resolveComponent("Foo")
const n0 = _createComponent(_component_Foo, [() => (_ctx.obj)], true)
const n0 = _createComponent(_component_Foo, [
() => (_ctx.obj)
], true)
return n0
}"
`;
Expand All @@ -135,9 +139,10 @@ exports[`compiler: element transform > component > v-bind="obj" after static pro

export function render(_ctx) {
const _component_Foo = _resolveComponent("Foo")
const n0 = _createComponent(_component_Foo, [{
id: () => ("foo")
}, () => (_ctx.obj)], true)
const n0 = _createComponent(_component_Foo, [
{ id: () => ("foo") },
() => (_ctx.obj)
], true)
return n0
}"
`;
Expand All @@ -147,9 +152,10 @@ exports[`compiler: element transform > component > v-bind="obj" before static pr

export function render(_ctx) {
const _component_Foo = _resolveComponent("Foo")
const n0 = _createComponent(_component_Foo, [() => (_ctx.obj), {
id: () => ("foo")
}], true)
const n0 = _createComponent(_component_Foo, [
() => (_ctx.obj),
{ id: () => ("foo") }
], true)
return n0
}"
`;
Expand All @@ -159,11 +165,11 @@ exports[`compiler: element transform > component > v-bind="obj" between static p

export function render(_ctx) {
const _component_Foo = _resolveComponent("Foo")
const n0 = _createComponent(_component_Foo, [{
id: () => ("foo")
}, () => (_ctx.obj), {
class: () => ("bar")
}], true)
const n0 = _createComponent(_component_Foo, [
{ id: () => ("foo") },
() => (_ctx.obj),
{ class: () => ("bar") }
], true)
return n0
}"
`;
Expand All @@ -174,7 +180,36 @@ import { resolveComponent as _resolveComponent, createComponent as _createCompon

export function render(_ctx) {
const _component_Foo = _resolveComponent("Foo")
const n0 = _createComponent(_component_Foo, [() => (_toHandlers(_ctx.obj))], true)
const n0 = _createComponent(_component_Foo, [
() => (_toHandlers(_ctx.obj))
], true)
return n0
}"
`;

exports[`compiler: element transform > component with dynamic event arguments 1`] = `
"import { toHandlerKey as _toHandlerKey } from 'vue';
import { resolveComponent as _resolveComponent, createComponent as _createComponent } from 'vue/vapor';

export function render(_ctx) {
const _component_Foo = _resolveComponent("Foo")
const n0 = _createComponent(_component_Foo, [
() => ({ [_toHandlerKey(_ctx.foo-_ctx.bar)]: () => _ctx.bar }),
() => ({ [_toHandlerKey(_ctx.baz)]: () => _ctx.qux })
], true)
return n0
}"
`;

exports[`compiler: element transform > component with dynamic prop arguments 1`] = `
"import { resolveComponent as _resolveComponent, createComponent as _createComponent } from 'vue/vapor';

export function render(_ctx) {
const _component_Foo = _resolveComponent("Foo")
const n0 = _createComponent(_component_Foo, [
() => ({ [_ctx.foo-_ctx.bar]: _ctx.bar }),
() => ({ [_ctx.baz]: _ctx.qux })
], true)
return n0
}"
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ exports[`compiler: vModel transform > component > v-model for component should g

export function render(_ctx) {
const _component_Comp = _resolveComponent("Comp")
const n0 = _createComponent(_component_Comp, [{
modelValue: () => (_ctx.foo),
const n0 = _createComponent(_component_Comp, [
{ modelValue: () => (_ctx.foo),
"onUpdate:modelValue": () => $event => (_ctx.foo = $event),
modelModifiers: () => ({ trim: true, "bar-baz": true })
}], true)
modelModifiers: () => ({ trim: true, "bar-baz": true }) }
], true)
return n0
}"
`;
Expand All @@ -19,10 +19,10 @@ exports[`compiler: vModel transform > component > v-model for component should w

export function render(_ctx) {
const _component_Comp = _resolveComponent("Comp")
const n0 = _createComponent(_component_Comp, [{
modelValue: () => (_ctx.foo),
"onUpdate:modelValue": () => $event => (_ctx.foo = $event)
}], true)
const n0 = _createComponent(_component_Comp, [
{ modelValue: () => (_ctx.foo),
"onUpdate:modelValue": () => $event => (_ctx.foo = $event) }
], true)
return n0
}"
`;
Expand All @@ -32,14 +32,16 @@ exports[`compiler: vModel transform > component > v-model with arguments for com

export function render(_ctx) {
const _component_Comp = _resolveComponent("Comp")
const n0 = _createComponent(_component_Comp, [{
foo: () => (_ctx.foo),
"onUpdate:foo": () => $event => (_ctx.foo = $event),
fooModifiers: () => ({ trim: true }),
bar: () => (_ctx.bar),
"onUpdate:bar": () => $event => (_ctx.bar = $event),
barModifiers: () => ({ number: true })
}], true)
const n0 = _createComponent(_component_Comp, [
{
foo: () => (_ctx.foo),
"onUpdate:foo": () => $event => (_ctx.foo = $event),
fooModifiers: () => ({ trim: true }),
bar: () => (_ctx.bar),
"onUpdate:bar": () => $event => (_ctx.bar = $event),
barModifiers: () => ({ number: true })
}
], true)
return n0
}"
`;
Expand All @@ -49,10 +51,10 @@ exports[`compiler: vModel transform > component > v-model with arguments for com

export function render(_ctx) {
const _component_Comp = _resolveComponent("Comp")
const n0 = _createComponent(_component_Comp, [{
bar: () => (_ctx.foo),
"onUpdate:bar": () => $event => (_ctx.foo = $event)
}], true)
const n0 = _createComponent(_component_Comp, [
{ bar: () => (_ctx.foo),
"onUpdate:bar": () => $event => (_ctx.foo = $event) }
], true)
return n0
}"
`;
Expand All @@ -62,14 +64,14 @@ exports[`compiler: vModel transform > component > v-model with dynamic arguments

export function render(_ctx) {
const _component_Comp = _resolveComponent("Comp")
const n0 = _createComponent(_component_Comp, [{
[_ctx.foo]: () => (_ctx.foo),
const n0 = _createComponent(_component_Comp, [
() => ({ [_ctx.foo]: _ctx.foo,
["onUpdate:" + _ctx.foo]: () => $event => (_ctx.foo = $event),
[_ctx.foo + "Modifiers"]: () => ({ trim: true }),
[_ctx.bar]: () => (_ctx.bar),
[_ctx.foo + "Modifiers"]: () => ({ trim: true }) }),
() => ({ [_ctx.bar]: _ctx.bar,
["onUpdate:" + _ctx.bar]: () => $event => (_ctx.bar = $event),
[_ctx.bar + "Modifiers"]: () => ({ number: true })
}], true)
[_ctx.bar + "Modifiers"]: () => ({ number: true }) })
], true)
return n0
}"
`;
Expand All @@ -79,10 +81,10 @@ exports[`compiler: vModel transform > component > v-model with dynamic arguments

export function render(_ctx) {
const _component_Comp = _resolveComponent("Comp")
const n0 = _createComponent(_component_Comp, [{
[_ctx.arg]: () => (_ctx.foo),
["onUpdate:" + _ctx.arg]: () => $event => (_ctx.foo = $event)
}], true)
const n0 = _createComponent(_component_Comp, [
() => ({ [_ctx.arg]: _ctx.foo,
["onUpdate:" + _ctx.arg]: () => $event => (_ctx.foo = $event) })
], true)
return n0
}"
`;
Expand Down
Loading
Loading