Closed GreatLiyi closed 5 years ago
什么意思?
什么意思? 原生界面push到webview的时候,怎么把值传给service层,service层是和js交互的
native主动和web交互不能依靠service,得通过webview执行那个js脚本api给web传值。所以你至少得等js资源加载完成之后才能执行js脚本。
或者你在service层把方法准备好,等web资源都加载完成后让web主动调用你的service方法去拿数据。
或者你在service层把方法准备好,等web资源都加载完成后让web主动调用你的service方法去拿数据。
问题是service层怎么获取native的数据,是不是native把值传到webview,然后获取topviewcontroller的数据吗,活着通过单例传值
两个办法: 1、web加载完成后,你获取到当前的webview然后执行js脚本,把值传给web。 2、在service里,想办法获取到数据(单例、数据库、归档什么都可以),再传给web。
两个办法: 1、web加载完成后,你获取到当前的webview然后执行js脚本,把值传给web。 2、在service里,想办法获取到数据(单例、数据库、归档什么都可以),再传给web。
好的,谢谢哈,可以close了
先把原生界面的数据传到H5,然后H5再传到service,这种做法太笨拙了