fix(compiler-vapor): add newline after effect body
This commit is contained in:
parent
697102f796
commit
126796edb9
|
@ -340,7 +340,8 @@ export function render(_ctx) {
|
|||
_renderEffect(() => {
|
||||
_on(n1, (_ctx.event) === "click" ? "mouseup" : (_ctx.event), () => _ctx.test, undefined, {
|
||||
modifiers: ["middle"]
|
||||
})})
|
||||
})
|
||||
})
|
||||
return n0
|
||||
}"
|
||||
`;
|
||||
|
@ -370,7 +371,8 @@ export function render(_ctx) {
|
|||
_on(n1, (_ctx.event) === "click" ? "contextmenu" : (_ctx.event), () => _ctx.test, undefined, {
|
||||
modifiers: ["right"],
|
||||
keys: ["right"]
|
||||
})})
|
||||
})
|
||||
})
|
||||
return n0
|
||||
}"
|
||||
`;
|
||||
|
@ -398,7 +400,8 @@ export function render(_ctx) {
|
|||
_on(n1, _ctx.e, () => _ctx.test, undefined, {
|
||||
modifiers: ["left"],
|
||||
keys: ["left"]
|
||||
})})
|
||||
})
|
||||
})
|
||||
return n0
|
||||
}"
|
||||
`;
|
||||
|
|
|
@ -76,14 +76,14 @@ export function genEffect({ operations }: IREffect, context: CodegenContext) {
|
|||
`${vaporHelper('renderEffect')}(() => `,
|
||||
)
|
||||
|
||||
const [fragOps, pushOps] = buildCodeFragment()
|
||||
const [operationsExps, pushOps] = buildCodeFragment()
|
||||
operations.forEach(op => pushOps(...genOperation(op, context)))
|
||||
|
||||
const newlineCount = fragOps.filter(frag => frag === NEWLINE).length
|
||||
const newlineCount = operationsExps.filter(frag => frag === NEWLINE).length
|
||||
if (newlineCount > 1) {
|
||||
push('{', INDENT_START, ...fragOps, INDENT_END, '})')
|
||||
push('{', INDENT_START, ...operationsExps, INDENT_END, NEWLINE, '})')
|
||||
} else {
|
||||
push(...fragOps.filter(frag => frag !== NEWLINE), ')')
|
||||
push(...operationsExps.filter(frag => frag !== NEWLINE), ')')
|
||||
}
|
||||
|
||||
return frag
|
||||
|
|
Loading…
Reference in New Issue