Skip to content

Commit

Permalink
wip: save
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 committed Dec 5, 2024
1 parent a3984a7 commit f1baf94
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,10 @@ export function render(_ctx) {
_delegate(n0, "click", () => _ctx.handleClick)
_setInheritAttrs(["id"])
let _count, _count1
_renderEffect(() => _count !== _ctx.count && _setText(n0, (_count = _ctx.count), "foo", _ctx.count, "foo", _ctx.count)
_count1 !== _ctx.count && _setDOMProp(n0, "id", (_count1 = _ctx.count)))
_renderEffect(() => {
_count !== _ctx.count && _setText(n0, (_count = _ctx.count), "foo", _ctx.count, "foo", _ctx.count)
_count1 !== _ctx.count && _setDOMProp(n0, "id", (_count1 = _ctx.count))
})
return n0
}"
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ export function render(_ctx) {
const n1 = _createTextNode(() => [_ctx.second, " ", _ctx.third, " "])
_insert(n1, n4, n3)
let _first, _forth
_renderEffect(() => _first !== _ctx.first && _setText(n0, (_first = _ctx.first))
_forth !== _ctx.forth && _setText(n2, (_forth = _ctx.forth)))
_renderEffect(() => {
_first !== _ctx.first && _setText(n0, (_first = _ctx.first))
_forth !== _ctx.forth && _setText(n2, (_forth = _ctx.forth))
})
return n4
}"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ export function render(_ctx) {
const n0 = _createFor(() => (_ctx.items), (_ctx0) => {
const n2 = t0()
_setInheritAttrs(["item", "index"])
_renderEffect(() => _setDynamicProp(n2, "item", _ctx0[0].value)
_setDynamicProp(n2, "index", _ctx0[1].value))
_renderEffect(() => {
_setDynamicProp(n2, "item", _ctx0[0].value)
_setDynamicProp(n2, "index", _ctx0[1].value)
})
return n2
})
return n0
Expand Down
4 changes: 3 additions & 1 deletion packages/compiler-vapor/src/generators/operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,16 @@ export function genEffects(
const { vaporHelper } = context
const [frag, push, unshift] = buildCodeFragment()
const declareNames = new Set<string>()
let operationsCount = 0
for (let i = 0; i < effects.length; i++) {
const effect = (context.processingRenderEffect = effects[i])
operationsCount += effect.operations.length
i > 0 && push(NEWLINE)
push(...genEffect(effect, context, declareNames))
}

const newLineCount = frag.filter(frag => frag === NEWLINE).length
if (newLineCount > 1) {
if (newLineCount > 1 || operationsCount > 1) {
unshift(`{`, INDENT_START, NEWLINE)
push(INDENT_END, NEWLINE, '}')
}
Expand Down

0 comments on commit f1baf94

Please sign in to comment.