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

小猪活动页自动构建平台问题整理 #21

Open
rico-c opened this issue Jan 18, 2019 · 0 comments
Open

小猪活动页自动构建平台问题整理 #21

rico-c opened this issue Jan 18, 2019 · 0 comments
Labels

Comments

@rico-c
Copy link
Owner

rico-c commented Jan 18, 2019

一次请求多次返回处理

报错Error: Can't set headers after they are sent,需要找到res.send()后还在运行并有能力返回值的函数,发现在初始化创建页面时,绑定了一个监听npm run dev的事件,而在后续该事件依旧在继续触发,这里使用变量标识并禁止第二次以后的触发返回值。

         var child = shell.exec('npm run dev', { async: true });
        // 监听webpack运行成功后返回http服务端口及域名,回传至前端用于模拟器iframe
        // Node.js不允许一次请求多次返回,使用变量标识,禁止第二次事件以后的数据返回
        var initBack = true;
        child.stdout.on('data', function (data) {
          if (data.indexOf('http') !== -1) {
            initBack && res.send(data);
            initBack = false;
          }

层叠失效

不要向div中注入domProps.innerHTML变量,会覆盖递归调用createElement

克隆拖拽,拖入层叠子元素时会同时注入相同父元素

因为是浅拷贝,需要改为深拷贝

deepClone(el) {
      return JSON.parse(JSON.stringify(el));
    }
@rico-c rico-c changed the title 小猪活动页自动构建平台整理 小猪活动页自动构建平台问题整理 Jan 18, 2019
@rico-c rico-c added the 笔记 label Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant