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

当使用Chrome的console来和组件交互时(或者使用移动端evaluateJavaScript时),Toast显示不正常 #92

Closed
Shandawei opened this issue Oct 31, 2018 · 1 comment
Assignees

Comments

@Shandawei
Copy link
Contributor

Version

0.9.6

Environment

macOS10.14 chrome(70.0.3538.77),安卓或者苹果手机的Webview

Reproduction link

https://stackblitz.com/run?stackblitz无法复现内容,重现步骤有项目下载链接

Steps to reproduce

stackblitz 无法实现,请下载 https://dh-development.oss-cn-beijing.aliyuncs.com/BridgeTest.zip
npm install
ng serve
在console 运行bridge.test(),这种状况类似于在iOS或者Android执行evaluateJavaScript
Toast显示异常

What is expected?

Toast正常显示.这种情况出现的原因是什么呢?因为我们希望使用js bridge来和native之间进行通讯,目前可以使用window,postMessage解决,请问这个是什么原因造成的呢?同样的情况进行route进行路由切换也会造成页面混杂,不同页面混合在一起.

What is actually happening?

显示不正常,不完整.

Other?

寻求解决办法以及出现这种状况的原因.谢谢

@Guoyuanqiang Guoyuanqiang self-assigned this Nov 1, 2018
@Shandawei
Copy link
Contributor Author

Shandawei commented Nov 1, 2018

@Guoyuanqiang 谢谢,已解决,这个问题是,由于外部调用js来执行组件里的方法,跨环境的原因造成angular组件显示异常,注入NgZone

 constructor(private zone: NgZone){
}

//外部调用时使用需要使用ngZone调用组件内操作
  test_showLoading() {
    this.zone.run(() => {
      const toast = Toast.success('Load success !!!', 3000, () => {
        console.log('success');
      });
    });
  }

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

2 participants