glass-easel icon indicating copy to clipboard operation
glass-easel copied to clipboard

Fix placeholder's dataset inside wx:for

Open Tidyzq opened this issue 2 months ago • 0 comments

Fix placeholder's dataset inside wx:for by creating an extra js scope for wx:for (and slot props).

Giving an example template <child wx:for="{{arr}}" prop="{{item}}" data-index="{{index}}">{{index}}</child> Proc-gen generated code will be changed as the following:

- var i = (C, T) => {
-   C || K || g ? T(Y(e)) : T();
- },
  c = (C, d, e, f, g, h, T, E) => {
+   var i = (C, T) => {
+     C || K || g ? T(Y(e)) : T();
+   };
    E(
      "child",
      {},
      (N, C) => {
        if (C || K || f) O(N, "prop", d);
        if (C || K || g) R.d(N, "index", e);
      },
      i
    );
  },
  a = (C, T, E, B, F) => {
    F(D.arr, null, U ? U.arr : undefined, [0, "arr"], c);
  };

Tidyzq avatar May 13 '24 04:05 Tidyzq