@dongmingzhixiu/vuexir-compiler 0.5.1 → 0.5.2
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 +20 -6
- package/package.json +1 -1
package/dist/transform/vue2ir.js
CHANGED
|
@@ -2172,12 +2172,26 @@ function walkElement(node, classProps, comboRules, scopedRules, pseudoRules, war
|
|
|
2172
2172
|
continue;
|
|
2173
2173
|
}
|
|
2174
2174
|
if (child.type === NodeTypes.ELEMENT) {
|
|
2175
|
-
// R137:<button><span>{{
|
|
2176
|
-
|
|
2177
|
-
if (
|
|
2178
|
-
const
|
|
2179
|
-
|
|
2180
|
-
|
|
2175
|
+
// R137/R138:<button><span>{{ a }}</span><span>{{ b }}</span></button>
|
|
2176
|
+
// → 把所有动态段拼成一句文案(此前只收静态文本,或只取第一段)
|
|
2177
|
+
if (!props.bind && !props.label) {
|
|
2178
|
+
const names = [];
|
|
2179
|
+
const collect = (el) => {
|
|
2180
|
+
for (const cc of el.children ?? []) {
|
|
2181
|
+
const node2 = cc;
|
|
2182
|
+
if (node2.type === NodeTypes.INTERPOLATION) {
|
|
2183
|
+
const raw = textOf(node2.content).trim();
|
|
2184
|
+
if (raw && !/['"]/.test(raw))
|
|
2185
|
+
names.push(raw);
|
|
2186
|
+
}
|
|
2187
|
+
else if (node2.children) {
|
|
2188
|
+
collect(node2);
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
};
|
|
2192
|
+
collect(child);
|
|
2193
|
+
if (names.length > 0) {
|
|
2194
|
+
props.bind = addJsExprState(names.length === 1 ? names[0] : names.map((n) => `(${n})`).join(` + " · " + `));
|
|
2181
2195
|
continue;
|
|
2182
2196
|
}
|
|
2183
2197
|
}
|