Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui-select组件的默认值是空字符串 #500

Closed
toadprince opened this issue Apr 3, 2023 · 1 comment
Closed

ui-select组件的默认值是空字符串 #500

toadprince opened this issue Apr 3, 2023 · 1 comment

Comments

@toadprince
Copy link

ui-select一般是用在事件面板中,不过这个组件我也用在了属性面板中,指定当前组件关联的其他的组件,比如:所属地图。
然后问题是,上次源码更新后,点击所属地图的组件后,events属性默认赋值了空字符串,只有在dsl里手动改成[]才能正常跑起来

@toadprince
Copy link
Author

修改packages/editor/src/services/editor.ts中的update方法:

  public async update(config: MNode | MNode[]): Promise<MNode | MNode[]> {
    const nodes = Array.isArray(config) ? config : [config];
    //新增如下代码解决events莫名其妙被赋空字符串的问题
    nodes.forEach(n=>{
      if(n?.events === ""){
        n.events = [];
      }
    });

    const newNodes = await Promise.all(nodes.map((node) => this.doUpdate(node)));

    this.pushHistoryState();

    this.emit('update', newNodes);
    return Array.isArray(config) ? newNodes : newNodes[0];
  }

但我实在没找到events什么时候给赋值了空字符串

@jia000 jia000 closed this as completed in abcac71 Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant