@dongmingzhixiu/vuexir-compiler 0.5.0 → 0.5.1
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/transform/vue2ir.js +9 -0
- package/package.json +1 -1
package/dist/transform/vue2ir.js
CHANGED
|
@@ -2172,6 +2172,15 @@ function walkElement(node, classProps, comboRules, scopedRules, pseudoRules, war
|
|
|
2172
2172
|
continue;
|
|
2173
2173
|
}
|
|
2174
2174
|
if (child.type === NodeTypes.ELEMENT) {
|
|
2175
|
+
// R137:<button><span>{{ x }}</span></button> → 动态文案走 bind(此前只能收静态文本)
|
|
2176
|
+
const interp = (child.children ?? []).find((cc) => cc.type === NodeTypes.INTERPOLATION);
|
|
2177
|
+
if (interp && !props.bind && !props.label) {
|
|
2178
|
+
const raw = textOf(interp.content).trim();
|
|
2179
|
+
if (raw && !/['"]/.test(raw)) {
|
|
2180
|
+
props.bind = addJsExprState(raw);
|
|
2181
|
+
continue;
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2175
2184
|
// 常见写法兜底:<button><span>文字</span></button> → 内联文本并入 label(否则 IR 校验因缺 label 中断)
|
|
2176
2185
|
const inner = elementInnerText(child).trim();
|
|
2177
2186
|
if (inner) {
|