@sprlab/wccompiler 0.5.2 → 0.5.3
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/lib/codegen.js +9 -2
- package/package.json +1 -1
package/lib/codegen.js
CHANGED
|
@@ -761,9 +761,16 @@ export function generateComponent(parseResult, options = {}) {
|
|
|
761
761
|
lines.push(` this.${b.varName}.textContent = this._c_${b.name}() ?? '';`);
|
|
762
762
|
lines.push(' }));');
|
|
763
763
|
} else {
|
|
764
|
-
// method type —
|
|
764
|
+
// method type — check if it's a props.x access pattern
|
|
765
|
+
let ref;
|
|
766
|
+
if (propsObjectName && b.name.startsWith(propsObjectName + '.')) {
|
|
767
|
+
const propName = b.name.slice(propsObjectName.length + 1);
|
|
768
|
+
ref = `this._s_${propName}()`;
|
|
769
|
+
} else {
|
|
770
|
+
ref = `this._${b.name}()`;
|
|
771
|
+
}
|
|
765
772
|
lines.push(' this.__disposers.push(__effect(() => {');
|
|
766
|
-
lines.push(` this.${b.varName}.textContent =
|
|
773
|
+
lines.push(` this.${b.varName}.textContent = ${ref} ?? '';`);
|
|
767
774
|
lines.push(' }));');
|
|
768
775
|
}
|
|
769
776
|
}
|
package/package.json
CHANGED