@mulanjs/mulanjs 1.0.1-dev.20260310065810 → 1.0.1-dev.20260310071649
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.
|
@@ -319,7 +319,22 @@ function parseTag(content) {
|
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
else if (key) {
|
|
322
|
-
|
|
322
|
+
let finalKey = key;
|
|
323
|
+
let finalValue = value;
|
|
324
|
+
// Alias: mu-bind:attr="val" or :attr="val" -> translates to native MulanJS attr="${val}"
|
|
325
|
+
if (key.startsWith('mu-bind:')) {
|
|
326
|
+
finalKey = key.slice(8);
|
|
327
|
+
finalValue = `\${${value}}`;
|
|
328
|
+
}
|
|
329
|
+
else if (key.startsWith(':')) {
|
|
330
|
+
finalKey = key.slice(1);
|
|
331
|
+
finalValue = `\${${value}}`;
|
|
332
|
+
}
|
|
333
|
+
// Alias: mu-on:event="func()" -> translates to native @event
|
|
334
|
+
else if (key.startsWith('mu-on:')) {
|
|
335
|
+
finalKey = '@' + key.slice(6);
|
|
336
|
+
}
|
|
337
|
+
props[finalKey] = finalValue;
|
|
323
338
|
}
|
|
324
339
|
}
|
|
325
340
|
return { tag, props, directives };
|
package/package.json
CHANGED
|
@@ -369,7 +369,23 @@ export function parseTag(content: string) {
|
|
|
369
369
|
directives.vFor = { item: item.trim(), list: list.trim() };
|
|
370
370
|
}
|
|
371
371
|
} else if (key) {
|
|
372
|
-
|
|
372
|
+
let finalKey = key;
|
|
373
|
+
let finalValue = value;
|
|
374
|
+
|
|
375
|
+
// Alias: mu-bind:attr="val" or :attr="val" -> translates to native MulanJS attr="${val}"
|
|
376
|
+
if (key.startsWith('mu-bind:')) {
|
|
377
|
+
finalKey = key.slice(8);
|
|
378
|
+
finalValue = `\${${value}}`;
|
|
379
|
+
} else if (key.startsWith(':')) {
|
|
380
|
+
finalKey = key.slice(1);
|
|
381
|
+
finalValue = `\${${value}}`;
|
|
382
|
+
}
|
|
383
|
+
// Alias: mu-on:event="func()" -> translates to native @event
|
|
384
|
+
else if (key.startsWith('mu-on:')) {
|
|
385
|
+
finalKey = '@' + key.slice(6);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
props[finalKey] = finalValue;
|
|
373
389
|
}
|
|
374
390
|
}
|
|
375
391
|
|