Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

android接入weex,在二级页面无法从js端调用native方法 #1577

Closed
caijixia opened this issue Sep 25, 2018 · 4 comments
Closed

android接入weex,在二级页面无法从js端调用native方法 #1577

caijixia opened this issue Sep 25, 2018 · 4 comments

Comments

@caijixia
Copy link

Description

前置条件:

  • Application中执行了WXSDKEngine.initialize的初始化调用,并且注册了自定义的Module类
  • js端通过let module_xx = weex.requireModule('module-name')引入模块
  • js端通过module_xx调用由@JSMethod注解的方法

现在的问题是:

  • 如果渲染的是一级页面,module能正常调用到native方法;如果是二级页面, module_xx在前端打印的是undefined
  • 场景Page1 通过navigator.push启动到Page2. Page2 调用不到native方法,Page1 中是正常的
  • 但在Page2中,引入内置模块,调用正常.如modal可以正常toast,navigator可以正常切换页面
  • Page2中在 js端,取到的module_xx对象是undefined

Environment

gradle的依赖配置如下

//weex相关的版本,已经修改到较新的版本,老版本同样存在上面描述的问题
compile 'com.taobao.android:weex_sdk:0.18.0'
compile 'com.taobao.android:weex_inspector:0.16.20'
provided 'org.weex.plugin:processor:1.0.2'

Broken Example

Steps to Reproduce

@Hanks10100
Copy link
Contributor

Maybe you can offer some code snippets about your page1 and page2, check if your front-end code is correct.

@Hanks10100
Copy link
Contributor

This issue is closed because not giving a response for a long time. If you still confused with this question, you can file a new issue according to the issue template with enough information.

@caorushizi
Copy link

@caijixia 您好,最近我们也遇到这个问题,请问您最后是怎么解决的呢

@YorkShen
Copy link
Contributor

@caorushizi No one can help you without a runnable demo.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants