Fair icon indicating copy to clipboard operation
Fair copied to clipboard

生成的js代码语法错误

Open justLXX opened this issue 3 years ago • 1 comments

本地环境

 Flutter (Channel stable, 3.0.3, on macOS 13.0 22A380 darwin-arm (Rosetta), locale zh-Hans-CN)
    • Flutter version 3.0.3 at  /fvm/versions/3.0.3
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 676cefaaff (4 months ago), 2022-06-22 11:34:49 -0700
    • Engine revision ffe7b86a1e
    • Dart version 2.17.5
    • DevTools version 2.12.2
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

image 这部分代码进行fair改造。当然并没有一次性全部代码改为fair,而是将 item抽取为一个widget。代码如下

image image image fair对应的json

{
  "className": "Container",
  "na": {
    "height": 216,
    "width": 400,
    "child": {
      "className": "ListView",
      "na": {
        "padding": {
          "className": "EdgeInsets.only",
          "na": {
            "top": 0,
            "bottom": 0,
            "right": 16,
            "left": 16
          }
        },
        "scrollDirection": "#(Axis.horizontal)",
        "children": {
          "className": "Sugar.map",
          "pa": [
            "#(MealsListData.tabIconsList)"
          ],
          "na": {
            "builder": {
              "className": "MealsView",
              "na": {
                "mealsListData": "^(item)"
              }
            }
          }
        }
      }
    }
  },
  "methodMap": {}
}

对应的js

GLOBAL['#FairKey#']=(function(__initProps__){const __global__=this;defineModule(1,function(__mod__){with(__mod__.imports){function MealsView(){const inner=MealsView.__inner__;if(this==__global__){return new MealsView({__args__:arguments});}else{const args=arguments.length>0?arguments[0].__args__||arguments:[];inner.apply(this,args);MealsView.prototype.ctor.apply(this,args);return this;}}MealsView.__inner__=function inner(){StatelessWidget.__inner__.call(this);this.mealsListData=null;};MealsView.prototype={ctor:function ctor({key,mealsListData}={}){const __thiz__=this;const __arg_ctx__={key,mealsListData,};with(__thiz__){with(__arg_ctx__){this.mealsListData=mealsListData;StatelessWidget.prototype.ctor.call(__thiz__,key:key);}}},};inherit(MealsView,StatelessWidget);}__mod__.exports.MealsView=MealsView;},[]);return runCallback(function(__mod__){with(__mod__.imports){function _MealsListViewState(){const inner=_MealsListViewState.__inner__;if(this==__global__){return new _MealsListViewState({__args__:arguments});}else{const args=arguments.length>0?arguments[0].__args__||arguments:[];inner.apply(this,args);_MealsListViewState.prototype.ctor.apply(this,args);return this;}}_MealsListViewState.__inner__=function inner(){};_MealsListViewState.prototype={};_MealsListViewState.prototype.ctor=function(){Object.prototype.ctor.call(this);};;return _MealsListViewState();}},[1]);})(convertObjectLiteralToSetOrMap(JSON.parse('#FairProps#')));

错误信息 image

justLXX avatar Nov 16 '22 03:11 justLXX

收到,我们排查一下

yancechen avatar Nov 16 '22 03:11 yancechen