@dongmingzhixiu/vuexir-compiler 0.3.15 → 0.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codegen/compose.js +7 -2
- package/package.json +1 -1
package/dist/codegen/compose.js
CHANGED
|
@@ -701,7 +701,12 @@ function kotlinClickAction(p, ctx, loop) {
|
|
|
701
701
|
return dec[1] + ' = ' + dec[1] + ' - 1';
|
|
702
702
|
const push = h.match(/router(?:\.push|Push)?\(\s*(.+?)\s*\)/);
|
|
703
703
|
if (push) {
|
|
704
|
-
const
|
|
704
|
+
const arg0 = push[1].trim();
|
|
705
|
+
// R111:router.push({ name: 'x' }) / { path: 'x' } → 只取目标值(Kotlin 里对象字面量会被当 lambda)
|
|
706
|
+
const objM = arg0.match(/^\{[^}]*?(?:name|path)\s*:\s*['"]([^'"]+)['"]/);
|
|
707
|
+
if (objM)
|
|
708
|
+
return 'Runtime.push("' + objM[1] + '")';
|
|
709
|
+
const arg = arg0;
|
|
705
710
|
const isLit = (arg.startsWith("'") && arg.endsWith("'")) || (arg.startsWith('"') && arg.endsWith('"'));
|
|
706
711
|
if (isLit)
|
|
707
712
|
return 'Runtime.push(' + kotlinStr(arg.slice(1, -1)) + ')';
|
|
@@ -960,7 +965,7 @@ function emitNode(node, ctx, depth, loop, useParamModifier = false, parentStretc
|
|
|
960
965
|
if (node.condition && node.type !== 'root') {
|
|
961
966
|
return (pad + 'if (' + kotlinCondExpr(node.condition) + ') {\n' +
|
|
962
967
|
emitNodeInner(node, ctx, depth + 1, loop, useParamModifier, parentStretch) +
|
|
963
|
-
'\n' + pad + '}');
|
|
968
|
+
'\n' + pad + '}\n');
|
|
964
969
|
}
|
|
965
970
|
return emitNodeInner(node, ctx, depth, loop, useParamModifier, parentStretch);
|
|
966
971
|
}
|