├── .gitignore ├── .nojekyll ├── README.md ├── _coverpage.md ├── _navbar.md ├── _sidebar.md ├── en-us ├── QA.md ├── README.md ├── _sidebar.md ├── guide.md └── tutorial_newcomer.md ├── eros-products ├── dgg.png ├── dgg1.jpg ├── dgg2.jpg ├── dgg3.jpg ├── dgg4.jpg ├── dgg5.jpg ├── dgg6.jpg ├── duoli1.jpeg ├── duoli2.jpeg ├── duoli3.jpeg ├── duoli4.jpeg ├── fod1.jpg ├── fod2.jpg ├── fod3.jpg ├── fushan.jpeg ├── ger1.png ├── ger2.png ├── ger3.png ├── ger4.png ├── ger5.png ├── jex.png ├── jex1.png ├── jex2.png ├── jex3.png ├── jinxuan1.jpeg ├── jinxuan2.jpeg ├── jinxuan3.jpeg ├── jinxuan4.png ├── jinxuan5.png ├── korea1.png ├── korea2.png ├── korea3.png ├── mmphoto1.png ├── mmphoto10.png ├── mmphoto2.png ├── mmphoto3.png ├── mmphoto4.png ├── mmphoto5.png ├── mmphoto6.png ├── mmphoto7.png ├── mmphoto8.png ├── mmphoto9.png ├── school1.jpeg ├── school2.jpeg ├── school3.jpeg ├── school4.jpeg ├── school5.jpeg ├── shawn1.jpeg ├── shawn2.jpeg ├── shawn3.jpeg ├── shawn4.jpeg ├── shawn5.jpeg ├── shawn6.jpeg ├── spell1.png ├── spell2.png ├── spell3.png ├── spell4.png ├── star-new.jpeg ├── star-new1.jpeg ├── star-new2.jpeg ├── star-new3.jpeg ├── star-new4.jpeg ├── star-new5.jpeg ├── star-new6.jpeg ├── star-new7.jpeg ├── star-new8.jpeg ├── star-new9.jpeg ├── star.jpeg ├── star1.jpeg ├── star2.jpeg ├── star3.jpeg ├── star4.jpeg ├── star5.jpeg ├── star6.jpeg ├── star7.jpeg ├── star8.jpeg ├── star9.jpeg ├── wins.png ├── wins1.png ├── wins2.png ├── wins3.png ├── wins4.png ├── zero.jpg ├── 头条.png ├── 慧生活.png ├── 蜂觅.png ├── 蜂觅2.png ├── 蜂觅3.png ├── 蜂觅4.png ├── 蜂觅5.png ├── 连云港政协.jpg └── 连云港政协2.jpg ├── index.html └── zh-cn ├── 3d_getui.md ├── QA.md ├── README.md ├── advanced_appboard.md ├── advanced_bindingx.md ├── advanced_diff.md ├── advanced_mediator.md ├── advanced_publish.md ├── android_config.md ├── android_env.md ├── android_image.md ├── android_pack.md ├── android_plugin_integration.md ├── android_wx_apply.md ├── app_base_library.md ├── base_config.md ├── base_debug.md ├── base_dependencies.md ├── base_dev.md ├── base_env.md ├── base_extend.md ├── base_init.md ├── eros_intro.md ├── eros_plugin.md ├── eros_sdk_component.md ├── eros_sdk_module.md ├── eros_widget.md ├── image ├── addAccounts.png ├── addGetuiJson.jpeg ├── advanced_bindingx.gif ├── androidDemo.gif ├── bmap.jpg ├── bmap1.png ├── chart1.png ├── debug.gif ├── debug.png ├── del_link1.png ├── del_link2.png ├── eros-qq-qrcode.png ├── eros.ico ├── gesunlock.gif ├── getui.jpg ├── hotRefresh.gif ├── idfaSet.png ├── iosInstallError.jpeg ├── iosqr.png ├── modify_gradle_verison.jpg ├── qbmDatePicker.gif ├── removeAtsdk.png ├── right.png ├── rightItem@2x.png ├── shang.jpeg ├── show.gif └── xiaohua.png ├── ios_config.md ├── ios_image.md ├── ios_project.md ├── other_plugin.md ├── plugin_amap.md ├── plugin_getui_push.md ├── plugin_umAnalytics.md ├── plugin_wx_pay.md ├── plugin_wx_share.md ├── recommend.md ├── tutorial_newcomer.md ├── update_log_all.md ├── update_log_android.md ├── update_log_cli.md ├── update_log_ios.md └── update_log_template.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store -------------------------------------------------------------------------------- /.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/.nojekyll -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # 介绍 3 | **eros 是基于 [weex](https://weex-project.io/cn/) 封装面向前端的 vue 写法的解决方案,由于 app 开发的特殊性,eros 则更偏重关心于整个 app 项目。** 4 | 5 | 8 | 9 | | Android download QR code | 10 | |---------| 11 | |![android 下载](http://upload.ouliu.net/i/201801241911376ee1z.png)| 12 | 13 | * [Android 下载链接](https://fir.im/weexerosandroid) 14 | 15 | 16 | > 开发者可以扫描二维码来下载 Android 版本 eros app 来进行体验,iOS 请自行按照教程运行 demo 查看效果; 17 | 18 | # 开发之前你需要知道 19 | **如果您是前端开发者:** 20 | * 一定要熟练使用 vue 开发 21 | * 一定要详细阅读 weex 的文档,尤其是与 web 环境,vue 开发差异的部分。 22 | * 在开发客户端应用中,会有遇到无数的环境问题,程序问题,代码问题,绝大多数问题都可以在网上查到对应解决方案,在提出问题或者 issue 的时候,还请先自行尝试解决,eros 的环境安装会耗费很长的时间,你懂的。 23 | * 需要熟悉客户端开发打包流程。 24 | 25 | > 很多前端开发者在环境问题上便半途而废了,不过 eros 会一直完善文档,开发群中也会有大量开发者为您解答,还请保持一颗有始有终的心,会有收获的。 26 | 27 | **如果您是客户端开发者:** 28 | 29 | 那么环境您会迅速搭建起来,然后跟着熟读 vue,weex 的文档,因为 vue 上手非常快,最后跟着 eros 的新手教程写几个 demo 便可以开始开发,还可以轻松拓展 module。 30 | 31 | # 必备知识 32 | 开发之前您需要学习 weex 知识,并且能熟练使用 vue 开发,文档地址如下。 33 | * [weex](http://weex.apache.org/cn/guide/) 34 | * [vue](https://cn.vuejs.org/v2/guide/) 35 | 36 | # 支持性 37 | > 跟随着 weex 的支持性,`但目前我们并不支持开发代码兼容 web 端` 38 | 39 | * Android 4.1 (API 16) 40 | * iOS 8.0+ 41 | * WebKit 534.30+ 42 | 43 | # eros 优点 44 | eros 提供了: 45 | * 详细的文档来解决环境搭建过程中的坑。 46 | * 一套代码编译成 ios,android 两端原生应用。 47 | * 封装了大量 weex module,让前端开发方便进行原生的操作。 48 | * 支持大量 `echart` 实例运行。 49 | * 可以通过 `appboard` 机制来减少多页面项目中的代码冗余,减少包体积,并可以对其实时修改。 50 | * 内置了一套完整的 JS 二次封装 module (widget) ,直接通过 vue 插件系统注入,直接在 `this` 上调用,可根据业务自行修改。 51 | * 内置了中介者服务,来进行多个页面间的交互,并可以管理业务。 52 | * 内置了服务器端增量发布更新逻辑,可以搭配着开源的简易增量发布系统一起使用。 53 | * 支持真机和模拟器通过 `weex debug` 来断点调试,程序报错均会有报错日志弹窗提示。 54 | 55 | 可以通过脚手架: 56 | * 直接生成开发最新模板。 57 | * 启动服务进行实时开发效果查看和 debug 调试。 58 | * 更新开发平台所需 eros 依赖。 59 | * 直接 `pack` 对应平台内置 `JS Bundle`。 60 | * 支持生成全量包,增量包,并内置与更新服务器交互逻辑。 61 | * 支持同步更新模板内容。 62 | * 支持 weex 的 vue 入口和 js 入口两种开发方式。 63 | 64 | 支持市面上流行的组件库: 65 | * [weex-ui](https://github.com/alibaba/weex-ui) ( 阿里出品,推荐使用 ) 66 | * [bui](https://github.com/bingo-oss/bui-weex) 67 | 68 | # eros 不足 69 | > eros 开发中也有很多限制,需要开发者自行斟酌。 70 | 71 | * 尽管 weex 支持编译三端,**但 eros 目前不支持浏览器端**,目前只会专注于原生。 72 | * eros 暂时不能自动使用 weex 市场,但如果您有原生开发经验可以自行接入。 73 | * 由于 eros 对 **JS Bundle** 运行机制采用了 appboard 机制来减少了 js bundle 的大小,导致 weex debug 需要特定的处理。 74 | * 如果遇到复杂的页面,如 IM 之类的,eros 建议用原生实现,weex 应付此类需求还是比较吃力。 75 | 76 | # 原理视图 77 | 78 | ![工作原理](http://on-img.com/chart_image/59c5d743e4b0d34a18d69580.png) 79 | [大图地址](http://on-img.com/chart_image/59c5d743e4b0d34a18d69580.png) 80 | 81 | # 开源现状 82 | 目前 `eros` 已有数十个 app 在开发中和上线的状态,其中有正在开发中的国外应用 **starLife(100+页面)**,也有国内正在开发的**蜂觅(60+ 页面)**,还有**已上线的应用都在 0-50+ 页面不等**,涉及行业分布于资讯,招商,购物,政府,办公等等。 83 | 84 | 85 | 后续版本中会陆续展示优秀项目到首页,所以开发者大可放心,已基于 MIT 协议开源。 86 | 87 | 88 | # 周边系统 89 | | Project | Description | 90 | |---------|-------------| 91 | | [eros-cli](https://github.com/bmfe/eros-cli) | 简单的 eros 项目构建工具,可以提供搭建,开发,调试和发布等功能。 | 92 | | [eros-publish](https://github.com/bmfe/eros-publish) | 简单的服务器差分包更新逻辑,需要和脚手架搭配使用。 | 93 | | [eros-ios-library](https://github.com/bmfe/Benmu-iOS-Library) | eros ios Weex 项目依赖库。 | 94 | | [eros-ios-sdk](https://github.com/bmfe/WeexiOSSDK) | eros ios Weex sdk。 | 95 | | [eros-android-framework](https://github.com/bmfe/WeexErosFramework) | eros weex 移动解决方案安卓端框架。 | 96 | | [eros-android-widget](https://github.com/bmfe/BMWidget) | eros 安卓组件库。 | 97 | | [eros-android-sdk](https://github.com/bmfe/WeexSDK) | eros 安卓移动解决方案安卓端 WeexSDK。 | 98 | 99 | # 社区贡献 100 | * [eros 网易严选](https://github.com/bmfe/eros-yanxuan-demo-v2) 101 | * [weex-eros-book 书籍阅读 app](https://github.com/wennjie/weex-book) 102 | * [lygtq-eros-publish 服务器增量发布逻辑](https://github.com/hodgevk/lygtq-eros-publish) 103 | * [eros-node-server 服务器增量发布逻辑](https://github.com/shawn-tangsc/eros-node-server) 104 | 105 | # 讨论组 106 | eros 正式开源到现在已经有了一个拥有大量开发者的群,群里有大量开发者已经有 eros 产品在开发中和已上线,为了维护一个良好的环境,还请先熟知以下群规: 107 | 108 | * **此并不是流量群,也并非广告群,是为了大家一起成长,保证信息的有效性,如果发黄赌毒,不和谐言语,与学习无关的广告,推广内容,无关小程序,不会商量,直接会被踢,且不会再有入群机会。** 109 | * eros开发中遇到任何问题可以随时发到群里 weex开发相关可以一起讨论。 110 | * 如果不能及时回答也请耐心等待,群里开发丰富经验的同学会帮您一起看问题。 111 | * 除了 eros 自身紧急 BUG 外的问题,均需要提 issue,我们会按 issue 处理,目的是为了更好的给其他开发者参考,紧急问题请直接抛到群里,我们会直接远程帮助您调试。 112 | 113 | QQ群: 114 | 开发者1群 **667379588** (满员)
115 | 开发者2群 **798677297** 116 | 117 | # License 118 | [MIT](https://opensource.org/licenses/MIT) 119 | 120 | Copyright (c) 2018-present, Byte Master Front End -------------------------------------------------------------------------------- /_coverpage.md: -------------------------------------------------------------------------------- 1 | # **EROS** 2 | 3 | > 一套 JS 代码,两端原生应用。 4 | 5 | [GitHub](https://github.com/bmfe/eros) 6 | [Get Started](#介绍) 7 | 8 | 9 | ![color](#f8f8f8) -------------------------------------------------------------------------------- /_navbar.md: -------------------------------------------------------------------------------- 1 | - [中文](/zh-cn/) 2 | - [En](/en-us/) -------------------------------------------------------------------------------- /_sidebar.md: -------------------------------------------------------------------------------- 1 | - [ 基础 ] 2 | - [集成环境](/zh-cn/base_env) 3 | - [生成项目](/zh-cn/base_init) 4 | - [配置相关](/zh-cn/base_config) 5 | - [开发调试](/zh-cn/base_debug) 6 | - [业务开发](/zh-cn/base_dev) 7 | - [依赖更新](/zh-cn/base_dependencies) 8 | 9 | - [ 教程 ] 10 | - [入门](/zh-cn/tutorial_newcomer) 11 | 12 | - [ 拓展 ] 13 | - [eros | 增强](/zh-cn/base_extend) 14 | - [eros | widget](/zh-cn/eros_widget) 15 | - [eros | module](/zh-cn/eros_sdk_module) 16 | - [eros | component](/zh-cn/eros_sdk_component) 17 | 18 | - [进阶] 19 | - [appboard](/zh-cn/advanced_appboard) 20 | - [mediator](/zh-cn/advanced_mediator) 21 | - [bindingx](/zh-cn/advanced_bindingx) 22 | - [热更新原理](/zh-cn/advanced_diff) 23 | - [eros-publish](/zh-cn/advanced_publish) 24 | 25 | - [ Android 开发相关 ] 26 | - [配置](/zh-cn/android_config) 27 | - [图片相关配置](/zh-cn/android_image) 28 | - [发布打包](/zh-cn/android_pack) 29 | 30 | - [ iOS 开发相关 ] 31 | - [App名称、版本号设置](/zh-cn/ios_config) 32 | - [图片相关配置](/zh-cn/ios_image) 33 | - [工程简介及扩展](/zh-cn/ios_project) 34 | 35 | - [ Q & A ] 36 | - [问题集合](/zh-cn/QA) 37 | 38 | - [ 更新日志 ] 39 | - [汇总](/zh-cn/update_log_all) 40 | 41 | 42 | 43 | 44 | 45 | - [ Eros-Plugin ] 46 | - [插件化](/zh-cn/eros_plugin) 47 | - [基础库](/zh-cn/app_base_library) 48 | - [微信分享+微信登录](/zh-cn/plugin_wx_share) 49 | - [微信支付](/zh-cn/plugin_wx_pay) 50 | - [个推推送](/zh-cn/plugin_getui_push) 51 | - [高德地图](/zh-cn/plugin_amap) 52 | - [友盟统计](/zh-cn/plugin_umAnalytics) 53 | - [更多插件](/zh-cn/other_plugin) 54 | 55 | - [ 社区及推荐博文 ] 56 | - [推荐阅读](/zh-cn/recommend) 57 | -------------------------------------------------------------------------------- /en-us/QA.md: -------------------------------------------------------------------------------- 1 | ## Q: phone cannot online after setting agent 2 | 3 | A: 4 | 5 | 1.First check the documentation for`development and debugging`,Check to see if the agent tool is open(charles、fiddler or others),If not open, please open the relevant agent tools; 6 | 7 | - Charles Use tutorials:http://www.jianshu.com/p/fdd7c681929c 8 | - Fiddler Use tutorials:http://www.jianshu.com/p/99b6b4cd273c 9 | 10 | ## Q: eros dev development service unsuccessful 11 | 12 | A: 13 | if report an error 14 | ``` 15 | ... 16 | webpackRun.run is not a function 17 | ... 18 | ``` 19 | please `cd` in your new project to try 20 | 21 | **mac/linux:** 22 | Normally mac/linux there will not be any problem,if prompted to insufficient permissions, please use `sudo`。 23 | 24 | **windows** 25 | if prompted to insufficient permissions,if `dev.json` not modified.The default is port 80,Please find out 80 port occupation and shut down him。 26 | 27 | If reported the following error: 28 | > vue packages version mismatch 29 | 30 | Please install weex-toolkit globally ,and run: 31 | ``` 32 | weex repair 33 | ``` 34 | 35 | ## Q: Why is my current js bundle so big 36 | 37 | A: 38 | Currently, scaffolding is integrating tree-shaking,because the official did not use tree-shaking to optimize package size,so it takes time。 39 | 40 | Currently, you can optimize first: 41 | ``` 42 | // Currently: 43 | import {buiButton} from 'Eros/bui' 44 | 45 | // instead of: 46 | import buiButton from 'Eros/bui/components/buiButton' 47 | ``` 48 | 49 | This can significantly reduce the package size. 50 | 51 | ## Q: iOS resources download slow,or waiting time is huge(command: eros install ios) 52 | 53 | A: 54 | 55 | After performing ` eros install ios ` command will load from the git ios project required tripartite SDK,Because of network reason, or is the reason of wall some resources load huge slow. Even failed to load as shown below: 56 | 57 | ![](./image/iosInstallError.jpeg) 58 | 59 | **Solution**:Download the resource file from https://github.com/xiaohuapunk/WeexEros3Rd to the local,And copy (your project directory)/platforms/ios/WeexEros, and then run the eros install ios command again; 60 | 61 | ## Q: IOS template engineering certificateless real machine debugging 62 | 63 | A: 64 | 65 | > Since the release of Xcode7, Apple has allowed developers to debug without a license (there are some differences with the certificate, many functions are not used, such as push), a few steps can be achieved without certificate real machine debugging; 66 | 67 | ##### 1.Registered personal AppleID account 68 | 69 | - Log in to the developer background (https://developer.apple.com/) register an AppleID, if you have an account (that is, download the app log in to the account) to log in, agree to the terms; 70 | 71 | - In the Xcode account settings, add an account 72 | 73 | ![](./image/addAccounts.png) 74 | 75 | ##### 2No certificate real machine debugging need to close the `Push Notifications` function; otherwise it will report the following error message👇 76 | 77 | > Our template opened the push function, so you need to turn this feature off, personal account is not the function 78 |
79 | 80 | ![](http://ww4.sinaimg.cn/large/0060lm7Tly1fmlbm99iibj30i40amjt1.jpg) 81 | 82 | Solution: 83 | 84 | - Modify `Bundle Identifier` note:Need to be modified into something not used by others, Apple will verify the uniqueness 85 | 86 | ![](http://ww2.sinaimg.cn/large/0060lm7Tly1fmlbugnl9uj313w04m74s.jpg) 87 | 88 | - modify`team`,choose `None`(Need to set `team` to `none`) 89 | 90 | ![](http://ww3.sinaimg.cn/large/0060lm7Tly1fmlby2fkcnj313y0cuabw.jpg) 91 | 92 | - Find Gapabilities,Turn `Push Notifications` off 93 | 94 | ![](http://ww2.sinaimg.cn/large/0060lm7Tly1fmlc0xwiorj31840cqtb6.jpg) 95 | 96 | ##### 3.Set Team to your own account 97 | 98 | ##### Upgrade engineering files 99 | > remember to back up the project before updating
100 | > Some updates need to update the project file, not updated by `instal`, you need to use` eros update` command;
101 | 102 | After the terminal type `eros update` enter the file path prompts to update 103 | 104 | The following is each file path 105 | - install.sh: `/platforms/ios/WeexEros/install.sh` 106 | - Info:`/platforms/ios/WeexEros/WeexEros/Info.plist` 107 | - Podfile:`/platforms/ios/WeexEros/Podfile` 108 | - AppDelegate.m: `/platforms/ios/WeexEros/WeexEros/AppDelegate.m`
109 | After the upgrade needs to be execute again `eros install ios` 110 | 111 | ##### Remove ATSDK 112 | `Weex` default `integration of the ATSDK` performance monitoring tools, `Eros` also integrated the sdk before, sdk private api used, will result in the audit does not pass, `Eros` has now removed it, if you have been using the `Eros` iOS app developed below Is the removal method: 113 | 114 | > 2017.12.22 Initialization of the project does not require this operation 115 | 116 | ##### 1.Upgrade Podfile file 117 | 118 | - Podfile:`eros update`,The path to fill in `/platforms/ios/WeexEros/Podfile`. 119 | 120 | 121 | ##### 2.After upgrading, you need to run `eros install ios` again 122 | ##### 3.Modify the configuration file 123 | 124 | > In Xcode: Find the `Other Linker Flags` and expand it, remove the `ATSDK` references in Debug and Release, and note that you need to also remove the `-framework` above 125 | 126 | ![](./image/removeAtsdk.png) 127 | 128 | ##### 4.Re-run, successful operation shows that the removal was successful 129 | 130 | ## Q: errCode->wx_network_error msg->Unable to resolve host 'app.weex-eros.com':No address associated with hostname 131 | 132 | A: 133 | If this error proves that your phone or emulator is unable to connect to your service, you need to check the following to troubleshoot why you can not connect to the service. 134 | 1. Confirm service is open, you can access services such as: app.weex-eros.com: 8889 (if the port is not the same or need to change the corresponding). 135 | 2. If the computer can normally visit, then use the mobile browser to continue to view. 136 | 3. If the phone browser is not accessible then you may need to connect to the proxy. 137 | 4. If you set the proxy still can not access, please confirm whether the proxy is set up successfully, you can try to use mobile phone to access Baidu, whether it can visit, and the agent captured successfully. 138 | 5. If you do not want to set up an agent, try accessing your service directly from your phone's browser using ip (if ported plus), if you can directly access it successfully.You can change the jsServer field in your eros-demo/config /eros.native.js file to your ip (plus port if you remember). 139 | Then please re-pack running Android program 140 | 141 | 142 | ## Q: Android how to modify the package name (the same phone can run 2 eros project). 143 | 144 | A: Modify gradle.properties file APPLICATION_ID (gradle.properties file in the project with the directory). 145 | 146 | 147 | ## Q: Failed to resolve: com.android.support:appcompat 148 | ``` 149 | Failed to resolve: com.android.support:appcompat-v7:25.3.1 150 | Add Google Maven repository and sync project 151 | Show in File 152 | Show in Project Structure dialog 153 | ``` 154 | A: At this time you can click Add Google Maven repository and sync project to wait for the compilation to finish 155 | -------------------------------------------------------------------------------- /en-us/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Introduction 3 | **eros is based on [weex](https://weex-project.io/index.html) packaging front-facing vue wording solution, due to the particularity of app development, eros is more focused on the entire app project.** 4 | 5 | | iOS DEMO built-in | ios version download | android version download | 6 | |---------|---------|---------| 7 | |![eros-demo](http://upload.ouliu.net/i/20180122162536pcw67.gif)|![ios Download](http://chuantu.biz/t6/214/1516790387x-1404793130.png)|![android download](http://upload.ouliu.net/i/201801241911376ee1z.png)| 8 | 9 | * [iOS Download Link](http://fir.im/eros) 10 | * [Android Download Link](https://fir.im/weexerosandroid) 11 | 12 | 13 | > Developers can scan the QR code to download eros app to experience, iOS first need to open the App ** Settings -> General -> Device Management Trust Development Certificate.** 14 | 15 | # You need to know before developing 16 | **If you are a front-end developer:** 17 | * Must be proficient in using vue development 18 | * Be sure to read the weex documentation, especially with the web environment, vue development differences. 19 | * In the development of client applications, there will be numerous environmental problems encountered, program problems, code problems, the vast majority of problems can be found on the Internet corresponding solutions, in the issue or issue, please try it yourself solve, eros environment installation can take a long time, you understand. 20 | -* Need to be familiar with the client development package process. 21 | * Need to be familiar with the client development package process. 22 | 23 | > Many front-end developers are halfway through environmental issues, but eros keeps improving their documentation, and there are plenty of developers in the development community who can help you answer it. Keep it up-to-date and rewarding. 24 | 25 | **If you are a client developer:** 26 | 27 | Then environment you will quickly set up, and then follow the familiar vue, weex documentation, because vue get started very quickly, and finally follow eros tutorial to write a few demo can start the development, you can easily expand the module. 28 | # Essential knowledge 29 | Before you develop you need to learn about weex knowledge, and be proficient with vue development, the documentation address is as follows. 30 | * [weex](http://weex.apache.org/cn/guide/) 31 | * [vue](https://cn.vuejs.org/v2/guide/) 32 | 33 | # Support 34 | > Follow weex support, `but for the moment we do not support developing code compatible web-side` 35 | 36 | * Android 4.1 (API 16) 37 | * iOS 8.0+ 38 | * WebKit 534.30+ 39 | 40 | # eros 优点 41 | eros advantages: 42 | * Detailed documentation to solve the trouble in construction environment。 43 | * A set of code compiled into ios, android native application at both ends. 44 | * Encapsulated a large number of weex module, so that front-end development to facilitate the native operation. 45 | * Support a large number of echart examples running. 46 | * Reduce code redundancy in multi-page projects with the appboard js bundle, reduce package size, and make real-time changes to it. 47 | * Built a set of complete JS secondary package module (widget), injected directly through the vue plug-in system, directly called in this, according to the business to modify. 48 | * Built-in intermediary service to interact with multiple pages and manage business. 49 | * Built-in server-side incremental release update logic, can be used together with the open source incremental incremental release system. 50 | * Support for real machines and simulators through `weex debug` breakpoint debugging, the program will be error log error prompts. 51 | 52 | cli provides: 53 | * Generate directly to the development of the latest template. 54 | * Start the service for real-time development of view and debugging debugging. 55 | * Update eros dependencies required for development platform. 56 | * Direct `pack` platform built-in` JS Bundle`. 57 | * Support for generating full package, incremental package, and built-in and update server interaction logic. 58 | * Support synchronous update template content. 59 | * Support weex vue entrance and js entrance of two development methods. 60 | 61 | Support the popular component library: 62 | * [weex-ui](https://github.com/alibaba/weex-ui) ( (Ali produced, recommended ) 63 | * [bui](https://github.com/bingo-oss/bui-weex) 64 | 65 | # eros not enough 66 | > eros development there are many restrictions, developers need to consider. 67 | 68 | * -Although weex supports compiling three-terminal, ** eros does not currently support browser-side ** and currently only focuses on native. 69 | * eros can not automatically use weex market temporarily, but if you have native development experience you can access. 70 | * Because eros uses the appboard mechanism with the ** JS Bundle ** run-time mechanism to reduce the size of the js bundle, weex debug requires special processing. 71 | * If you encounter complex pages, such as IM, eros recommended native implementation, weex to cope with such needs is still relatively difficult. 72 | 73 | # Principle view 74 | 75 | ![How it works](http://on-img.com/chart_image/59c5d743e4b0d34a18d69580.png) 76 | [Big Picture Address](http://on-img.com/chart_image/59c5d743e4b0d34a18d69580.png) 77 | 78 | # The status of open source 79 | Currently, there are dozens of apps in development and on-line state, including the overseas application ** starLife (100+ pages) ** under development, as well as the domestic search ** (60+ pages ) **, there are ** applications are on the line 0-50 + page ranging **, involving the industry in information, medical, investment, shopping, government, office and so on. 80 | 81 | Future releases will continue to showcase excellent projects to the home page, so developers can rest assured that this is not a KPI project (the company does not have KPIs) and has been open source based on the MIT protocol. 82 | 83 | 84 | # Peripheral system 85 | | Project | Description | 86 | |---------|-------------| 87 | | [eros-cli](https://github.com/bmfe/eros-cli) | Simple eros project building tools for building, developing. | 88 | | [eros-publish](https://github.com/bmfe/eros-publish) | Simple server differential package update logic needs to be used with scaffolding. | 89 | | [eros-ios-library](https://github.com/bmfe/eros-plugin-ios-baseLibrary) | eros ios The Weex project depends on libraries. | 90 | | [eros-ios-sdk](https://github.com/bmfe/WeexiOSSDK) | eros ios Weex sdk。 | 91 | | [eros-android-framework](https://github.com/bmfe/WeexErosFramework) | eros weex Mobile Solutions Android Side Framework. | 92 | | [eros-android-widget](https://github.com/bmfe/BMWidget) | eros Android Component Library. | 93 | | [eros-android-sdk](https://github.com/bmfe/WeexSDK) | eros Android Mobile Solutions Android WexSDK. | 94 | 95 | # 社区贡献 96 | * [eros-yanxuan-demo](https://github.com/bmfe/eros-yanxuan-demo-v2) 97 | * [weex-eros-book Reading app](https://github.com/wennjie/weex-book) 98 | * [lygtq-eros-publish Server Incremental Publishing Logic](https://github.com/hodgevk/lygtq-eros-publish) 99 | * [eros-node-server Server Incremental Publishing Logi](https://github.com/shawn-tangsc/eros-node-server) 100 | 101 | # Discussion group 102 | eros officially open source now has a development group of nearly 300 people (only by invitation), there are a large number of developers in the group have eros product development and has been on the line, in order to maintain a good environment, please Familiarity with the following group rules: 103 | 104 | * This is not a traffic group, nor is it an advertising group, is to grow together to ensure the effectiveness of information, if the pornography gambling, discordant language, learning unrelated advertising, promotional content, irrelevant applets, not Will discuss, will be kicked directly, and no longer have the opportunity to enter.** 105 | * Eros development encountered any problems can be sent to the group weex development can be discussed together. 106 | * If you can not answer in a timely manner, please wait patiently, develop rich experience in the group of students will help you see the problem together. 107 | * In addition to eros its own emergency BUG issues, we need to raise issues, we will deal with the issue, the purpose is to better reference for other developers, emergency issues thrown directly into the group, we will be directly to help you remotely debug. 108 | 109 | 110 | **QQ group**:
111 | group1: **667379588** (full)
112 | group2: **798677297** 113 | 114 | # License 115 | [MIT](https://opensource.org/licenses/MIT) 116 | 117 | Copyright (c) 2018-present, Byte Master Front End -------------------------------------------------------------------------------- /en-us/_sidebar.md: -------------------------------------------------------------------------------- 1 | - 2 | - [Home](/en-us/) 3 | 4 | - [ Tutorial ] 5 | - [newcomer](/en-us/tutorial_newcomer) 6 | 7 | - [ Basic ] 8 | - [environment](/en-us/base_env) 9 | - [init project](/en-us/base_init) 10 | - [eros config](/en-us/base_config) 11 | - [develop & debug](/en-us/base_debug) 12 | - [hello eros](/en-us/base_dev) 13 | - [dependices update](/en-us/base_dependencies) 14 | 15 | 16 | - [ Extend ] 17 | - [eros-extend](/en-us/base_extend) 18 | - [eros-widget](/en-us/eros_widget) 19 | - [eros-module](/en-us/eros_sdk_module) 20 | - [eros-component](/en-us/eros_sdk_component) 21 | 22 | - [ Advanced ] 23 | - [JS Bundle remote update](/en-us/advanced_diff) 24 | 25 | - [ Android Config ] 26 | - [config](/en-us/android_config) 27 | - [release package](/en-us/android_pack) 28 | 29 | - [ iOS Config ] 30 | - [appname, version config](/en-us/ios_config) 31 | - [image config](/en-us/ios_image) 32 | 33 | - [ Q & A ] 34 | - [all](/en-us/QA) 35 | 36 | - [ Update Logs ] 37 | - [all](/en-us/update_log_all) 38 | 39 | - [ Third-party Services ] 40 | - [push](/en-us/3d_getui) 41 | -------------------------------------------------------------------------------- /en-us/guide.md: -------------------------------------------------------------------------------- 1 | # Guide 2 | 3 | 4 | #quick-start -------------------------------------------------------------------------------- /en-us/tutorial_newcomer.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/en-us/tutorial_newcomer.md -------------------------------------------------------------------------------- /eros-products/dgg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/dgg.png -------------------------------------------------------------------------------- /eros-products/dgg1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/dgg1.jpg -------------------------------------------------------------------------------- /eros-products/dgg2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/dgg2.jpg -------------------------------------------------------------------------------- /eros-products/dgg3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/dgg3.jpg -------------------------------------------------------------------------------- /eros-products/dgg4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/dgg4.jpg -------------------------------------------------------------------------------- /eros-products/dgg5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/dgg5.jpg -------------------------------------------------------------------------------- /eros-products/dgg6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/dgg6.jpg -------------------------------------------------------------------------------- /eros-products/duoli1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/duoli1.jpeg -------------------------------------------------------------------------------- /eros-products/duoli2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/duoli2.jpeg -------------------------------------------------------------------------------- /eros-products/duoli3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/duoli3.jpeg -------------------------------------------------------------------------------- /eros-products/duoli4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/duoli4.jpeg -------------------------------------------------------------------------------- /eros-products/fod1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/fod1.jpg -------------------------------------------------------------------------------- /eros-products/fod2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/fod2.jpg -------------------------------------------------------------------------------- /eros-products/fod3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/fod3.jpg -------------------------------------------------------------------------------- /eros-products/fushan.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/fushan.jpeg -------------------------------------------------------------------------------- /eros-products/ger1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/ger1.png -------------------------------------------------------------------------------- /eros-products/ger2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/ger2.png -------------------------------------------------------------------------------- /eros-products/ger3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/ger3.png -------------------------------------------------------------------------------- /eros-products/ger4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/ger4.png -------------------------------------------------------------------------------- /eros-products/ger5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/ger5.png -------------------------------------------------------------------------------- /eros-products/jex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/jex.png -------------------------------------------------------------------------------- /eros-products/jex1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/jex1.png -------------------------------------------------------------------------------- /eros-products/jex2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/jex2.png -------------------------------------------------------------------------------- /eros-products/jex3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/jex3.png -------------------------------------------------------------------------------- /eros-products/jinxuan1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/jinxuan1.jpeg -------------------------------------------------------------------------------- /eros-products/jinxuan2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/jinxuan2.jpeg -------------------------------------------------------------------------------- /eros-products/jinxuan3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/jinxuan3.jpeg -------------------------------------------------------------------------------- /eros-products/jinxuan4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/jinxuan4.png -------------------------------------------------------------------------------- /eros-products/jinxuan5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/jinxuan5.png -------------------------------------------------------------------------------- /eros-products/korea1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/korea1.png -------------------------------------------------------------------------------- /eros-products/korea2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/korea2.png -------------------------------------------------------------------------------- /eros-products/korea3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/korea3.png -------------------------------------------------------------------------------- /eros-products/mmphoto1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/mmphoto1.png -------------------------------------------------------------------------------- /eros-products/mmphoto10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/mmphoto10.png -------------------------------------------------------------------------------- /eros-products/mmphoto2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/mmphoto2.png -------------------------------------------------------------------------------- /eros-products/mmphoto3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/mmphoto3.png -------------------------------------------------------------------------------- /eros-products/mmphoto4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/mmphoto4.png -------------------------------------------------------------------------------- /eros-products/mmphoto5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/mmphoto5.png -------------------------------------------------------------------------------- /eros-products/mmphoto6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/mmphoto6.png -------------------------------------------------------------------------------- /eros-products/mmphoto7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/mmphoto7.png -------------------------------------------------------------------------------- /eros-products/mmphoto8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/mmphoto8.png -------------------------------------------------------------------------------- /eros-products/mmphoto9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/mmphoto9.png -------------------------------------------------------------------------------- /eros-products/school1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/school1.jpeg -------------------------------------------------------------------------------- /eros-products/school2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/school2.jpeg -------------------------------------------------------------------------------- /eros-products/school3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/school3.jpeg -------------------------------------------------------------------------------- /eros-products/school4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/school4.jpeg -------------------------------------------------------------------------------- /eros-products/school5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/school5.jpeg -------------------------------------------------------------------------------- /eros-products/shawn1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/shawn1.jpeg -------------------------------------------------------------------------------- /eros-products/shawn2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/shawn2.jpeg -------------------------------------------------------------------------------- /eros-products/shawn3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/shawn3.jpeg -------------------------------------------------------------------------------- /eros-products/shawn4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/shawn4.jpeg -------------------------------------------------------------------------------- /eros-products/shawn5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/shawn5.jpeg -------------------------------------------------------------------------------- /eros-products/shawn6.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/shawn6.jpeg -------------------------------------------------------------------------------- /eros-products/spell1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/spell1.png -------------------------------------------------------------------------------- /eros-products/spell2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/spell2.png -------------------------------------------------------------------------------- /eros-products/spell3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/spell3.png -------------------------------------------------------------------------------- /eros-products/spell4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/spell4.png -------------------------------------------------------------------------------- /eros-products/star-new.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star-new.jpeg -------------------------------------------------------------------------------- /eros-products/star-new1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star-new1.jpeg -------------------------------------------------------------------------------- /eros-products/star-new2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star-new2.jpeg -------------------------------------------------------------------------------- /eros-products/star-new3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star-new3.jpeg -------------------------------------------------------------------------------- /eros-products/star-new4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star-new4.jpeg -------------------------------------------------------------------------------- /eros-products/star-new5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star-new5.jpeg -------------------------------------------------------------------------------- /eros-products/star-new6.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star-new6.jpeg -------------------------------------------------------------------------------- /eros-products/star-new7.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star-new7.jpeg -------------------------------------------------------------------------------- /eros-products/star-new8.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star-new8.jpeg -------------------------------------------------------------------------------- /eros-products/star-new9.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star-new9.jpeg -------------------------------------------------------------------------------- /eros-products/star.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star.jpeg -------------------------------------------------------------------------------- /eros-products/star1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star1.jpeg -------------------------------------------------------------------------------- /eros-products/star2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star2.jpeg -------------------------------------------------------------------------------- /eros-products/star3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star3.jpeg -------------------------------------------------------------------------------- /eros-products/star4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star4.jpeg -------------------------------------------------------------------------------- /eros-products/star5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star5.jpeg -------------------------------------------------------------------------------- /eros-products/star6.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star6.jpeg -------------------------------------------------------------------------------- /eros-products/star7.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star7.jpeg -------------------------------------------------------------------------------- /eros-products/star8.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star8.jpeg -------------------------------------------------------------------------------- /eros-products/star9.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/star9.jpeg -------------------------------------------------------------------------------- /eros-products/wins.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/wins.png -------------------------------------------------------------------------------- /eros-products/wins1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/wins1.png -------------------------------------------------------------------------------- /eros-products/wins2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/wins2.png -------------------------------------------------------------------------------- /eros-products/wins3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/wins3.png -------------------------------------------------------------------------------- /eros-products/wins4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/wins4.png -------------------------------------------------------------------------------- /eros-products/zero.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/zero.jpg -------------------------------------------------------------------------------- /eros-products/头条.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/头条.png -------------------------------------------------------------------------------- /eros-products/慧生活.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/慧生活.png -------------------------------------------------------------------------------- /eros-products/蜂觅.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/蜂觅.png -------------------------------------------------------------------------------- /eros-products/蜂觅2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/蜂觅2.png -------------------------------------------------------------------------------- /eros-products/蜂觅3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/蜂觅3.png -------------------------------------------------------------------------------- /eros-products/蜂觅4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/蜂觅4.png -------------------------------------------------------------------------------- /eros-products/蜂觅5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/蜂觅5.png -------------------------------------------------------------------------------- /eros-products/连云港政协.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/连云港政协.jpg -------------------------------------------------------------------------------- /eros-products/连云港政协2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/eros-products/连云港政协2.jpg -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | EROS 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 23 |
Please wait...
24 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /zh-cn/3d_getui.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## eros消息推送(个推)配置流程 4 | 5 | ### 基本配置 6 | 7 | * 首先,你需要按照[个推文档](http://docs.getui.com/getui/start/ios/)去个推申请一个账号。最后获取引用配置中的appId,appKey和appSecret。 8 | 9 | * 然后你需要修改你应用内的native.js配置, 10 | 11 | ``` 12 | 'getui': { 13 | 'enabled': 'true', 14 | 'appId': , 15 | 'appKey': 16 | 'appSecret': 17 | }, 18 | ``` 19 | 20 | * 将配置写入你的原生端,在脚手架目录下执行 21 | 22 | ``` 23 | eros pack --all 24 | ``` 25 | * 这个时候,当你用真机启动应用的时候,你的cid和deviceToken就会传注册到个推官网。也就是说恭喜你,你现在可以接收到推送了 26 | 27 | ###个推官网后台推送测试 28 | 29 | * 进入你个推账号的开发者中心,然后选择你创建的应用点击创建推送。 30 | 31 | * 进入后选择透传消息(具体的差别可以看个推官方文档,最大的差别就是ios只收得到透传消息)。 32 | 33 | * 这里比较关键,因为原生端在收取站内推送的时候做了特殊处理,所以你需要传的消息格式是一个 34 | 35 | ``` 36 | {"payload":} 37 | ``` 38 | 39 | 所以,你可以直接把下面贴到个推官网的消息内容里 40 | 41 | ``` 42 | {"payload":"{\"aps\":{\"alert\":\"test\"}}"} 43 | ``` 44 | 也可以将你要的标准json通过下列方式贴进去 45 | 46 | addGetuiJson![](https://raw.githubusercontent.com/myliuyx/source/master/addGetuiJson.jpeg) 47 | * 下图是各参数的解释 48 | 49 | getui![](https://raw.githubusercontent.com/myliuyx/source/master/getui.jpg) 50 | 51 | ### 应用内如何接受 52 | 53 | * 在demo的config目录中,有一个push.js 文件。 54 | 55 | ``` 56 | globalEvent.addEventListener('pushMessage', function (options) { 57 | modal.alert({ 58 | message: 'hello'+JSON.stringify(options), 59 | duration: 0.3 60 | }, function (value) { 61 | console.log('alert callback', value) 62 | }) 63 | console.log('》》》》》》》》'+JSON.stringify(options)); 64 | }) 65 | 66 | ``` 67 | 你可以选择把消息用弹框弹出来,也可以直接看一下控制台。有特殊处理,就在这里直接处理就好了。 68 | 69 | ### 后台调试 70 | * 个推数据返回格式 71 | 72 | ``` 73 | { 74 | "payload":{ 75 | "aps":{ 76 | "alert":"test", 77 | } 78 | } 79 | } 80 | ``` 81 | > {"payload":"{\"aps\":{\"alert\":\"tes11\"}}"} 可直接复制此字符串直接去个推后台透传推送 82 | 83 | * 后端代码 84 | 85 | ``` 86 | AppConfig appConfig = appSelector.getAppConfig(context.getTemplate()); 87 | Map templateMap = context.getTemplate().getTemplateConfig().getExtConfig(); 88 | Map extMap = templateMap.entrySet().stream() 89 | .filter(entry -> entry.getKey().startsWith("GT_")) 90 | .collect(Collectors.toMap(entry -> entry.getKey().substring("GT_".length()), 91 | Entry::getValue)); 92 | 93 | SingleMessage message = new SingleMessage(); 94 | message.setOffline(true); 95 | message.setOfflineExpireTime(TimeUnit.DAYS.toMillis(1)); 96 | //判断是否客户端是否wifi环境下推送,1为在WIFI环境下,0为不限制网络环境。 97 | message.setPushNetWorkType(0); 98 | TransmissionTemplate template = appConfig.getBuilder() 99 | .setContent(context.getTemplate().getContent()) 100 | .setExt(extMap) 101 | .build(); 102 | message.setData(template); 103 | 104 | //2. create target 105 | Target target = new Target(); 106 | target.setAppId(appConfig.getAppId()); 107 | target.setClientId(context.getReceiver().getCid()); 108 | IPushResult ret = null; 109 | 110 | try { 111 | ret = appConfig.getiGtPush().pushMessageToSingle(message, target); 112 | logger.info("app消息推送返回结果:{}", JsonUtil.of(ret)); 113 | } catch (RequestException e) { 114 | logger.error("app推送消息出现异常:{}:{}", message, ret, e); 115 | ret = appConfig.getiGtPush().pushMessageToSingle(message, target, e.getRequestId()); 116 | } 117 | // TransmissionTemplate 相关代码 118 | public TransmissionTemplate build() { 119 | TransmissionTemplate transmissionTemplate = new TransmissionTemplate(); 120 | transmissionTemplate.setAppId(this.appId); 121 | transmissionTemplate.setAppkey(this.appKey); 122 | transmissionTemplate.setTransmissionType(this.transmissionType); 123 | 124 | APNPayload payload = new APNPayload(); 125 | payload.setBadge(1); 126 | payload.setContentAvailable(1); 127 | payload.setSound("default"); 128 | payload.setCategory("$由客户端定义"); 129 | payload.setAlertMsg(new APNPayload.SimpleAlertMsg(content)); 130 | this.ext.entrySet().forEach(entry -> { 131 | payload.addCustomMsg(entry.getKey(), entry.getValue()); 132 | }); 133 | transmissionTemplate.setTransmissionContent(JsonUtil.of(payload)); 134 | //推送模式 135 | if (!transmission) { 136 | transmissionTemplate.setAPNInfo(payload); 137 | 138 | } 139 | return transmissionTemplate; 140 | } 141 | 142 | ``` 143 | > 关键代码是 TransmissionTemplate 的 transmissionTemplate.setAPNInfo(payload); 144 | message.setData(template); 145 | 把 template 当做 message 的data -------------------------------------------------------------------------------- /zh-cn/QA.md: -------------------------------------------------------------------------------- 1 | ## Q: 有办法把方法挂载到this上面吗?挂到vue实例上,全局那种,到每个组件都能直接this.xxx()调用。 2 | 3 | 如图![](https://i.loli.net/2018/11/21/5bf4f8a857021.png) 4 | 5 | 每个页面使用的时候直接 this.$test 6 | 7 | ## Q: ios 老版本升级(包名修改的那个版本)出现的问题解决方案 8 | 基础包名改版版本日志: https://bmfe.github.io/eros-docs/#/zh-cn/update_log_all?id=_20181011 9 | > 问题1 如图 10 | 11 | 解决方案:若出现该位置报错,改为图中划线的代码即可 12 | 13 | ![](https://i.loli.net/2018/11/21/5bf4f8e4c8671.png) 14 | 15 | 16 | 17 | 18 | > 问题2 如图 19 | ![](https://i.loli.net/2018/11/21/5bf4f9244e907.png) 20 | 若出现如上图报错的 21 | 22 | 解决方案:搜索BMBaseLibrary,这两处地方将其改为 ErosPluginBaseLibrary。然后重新run即可 23 | 24 | 如图 25 | ![](https://i.loli.net/2018/11/21/5bf4f924ae23a.png) 26 | 27 | 28 | ## Q: android 提交google play收到SSL Error Handler错误 29 | 30 | 因为 SSL 的验证 google 检查的更严一些,但是国内一般都不会做这个检测。 31 | 32 | https://www.cnblogs.com/shoneworn/p/8182615.html 33 | 34 | 你可以参考这个 对 com.benmu.framework.activity.GlobalWebViewActivity 类 做一些修改吧。 35 | 36 | > 在 GlobalWebViewActivity 120行代码开始修改成如下。 37 | 38 | ``` java 39 | @Override 40 | public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { 41 | // handler.proceed(); 42 | final SslErrorHandler mHandler; 43 | mHandler = handler; 44 | AlertDialog.Builder builder = new AlertDialog.Builder(activity); 45 | builder.setMessage("ssl证书验证失败"); 46 | builder.setPositiveButton("继续", new DialogInterface.OnClickListener() { 47 | @Override 48 | public void onClick(DialogInterface dialog, int which) { 49 | mHandler.proceed(); 50 | } 51 | }); 52 | builder.setNegativeButton("取消", new DialogInterface.OnClickListener() { 53 | @Override 54 | public void onClick(DialogInterface dialog, int which) { 55 | mHandler.cancel(); 56 | } 57 | }); 58 | builder.setOnKeyListener(new DialogInterface.OnKeyListener() { 59 | @Override 60 | public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { 61 | if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) { 62 | mHandler.cancel(); 63 | dialog.dismiss(); 64 | return true; 65 | } 66 | return false; 67 | } 68 | }); 69 | AlertDialog dialog = builder.create(); 70 | dialog.show(); 71 | } 72 | ``` 73 | > 代码如果报错可能是因为你没有导包导致的,请对应impor 对应的包。 74 | 75 | ## Q: android 热更新 不替换bundle文件 76 | > 热更新 并没有报错,文件和版本检查所有的地方都没有问题,就是没有替换新的 buindle 文件,更新并没有生效。 77 | 78 | A: 79 | Android 增加了 APP 版本的检测。 您新包的 `eros.native.json` 里 version 版本如下: 80 | ``` 81 | 'version': { 82 | 'android': '1.0.0', 83 | 'iOS': '1.0.0' 84 | } 85 | ``` 86 | 不能高于 Android APP的版本,android 的版本 在 `/WeexFrameworkWrapper/app/build.gradle` 文件中 87 | `versionName` 字段,默认是 1.0版本。 88 | 89 | > 增加这个判断是为了防止一些可以做原生开发的同学 在某个版本中 对原生做了修改,然后发布更新包时会导致一些并没有更新Android APP 版本的用户发生错误。 90 | 91 | ## Q: Unable to resolve dependency for ':app@samplechannelDebug/compileClasspath': Could not resolve project :nexus. 92 | 93 | 如图![](https://raw.githubusercontent.com/myliuyx/source/master/not_install_error.png) 94 | 95 | 96 | 97 | A: 执行 `/platforms/android/WeexFrameworkWrapper` 目录下 `install.sh` 文件,等待完成 点击右上角 Try Again 98 | 99 | > 如果执行 `install.sh` 了还是不行,请检查下文件里是否存在文件如果只有1个文件或文件夹可能下载过程出错了,把文件夹删除了重新执行下 `install.sh` 100 | 101 | ## Q: 热刷新不起作用(手动指定服务地址) 102 | 103 | A: 104 | 105 | 热刷新不生效多半是因为你的电脑存在多个ip地址(虚拟网卡),导致 App 连接了错误的地址,可以通过在 `eros.native.js -> url` 中添加 `socketServer` 字段来指定热刷新服务地址来解决这个问题;
106 | 同时也可以添加`jsServer`字段来指定访问的服务地址(即`eros dev`服务的地址) 107 | 108 | ```js 109 | // eros.native.js 文件 110 | 'url': { 111 | ... 112 | // 在这里添加 socketServer 请将 ip 地址改为你电脑真实的地址,注意如果是 dhcp 分配的地址会发生变化 113 | 'socketServer': 'ws://192.168.15.252:8890', 114 | // 指定访问服务地址 115 | 'jsServer': "http://192.168.15.252" 116 | } 117 | ... 118 | ``` 119 | 120 | 121 | ## Q: 手机设置代理后不能上网 122 | 123 | A: 124 | 125 | 1.首先请在查看一次`开发调试`的文档,确认一下是否打开了代理工具(charles、fiddler或其他),如果没有打开请打开相关代理工具; 126 | 127 | - Charles 使用教程:http://www.jianshu.com/p/fdd7c681929c 128 | - Fiddler 使用教程:http://www.jianshu.com/p/99b6b4cd273c 129 | 130 | ## Q: eros dev 开发服务不成功 131 | 132 | A: 133 | 如果报错 134 | ``` 135 | ... 136 | webpackRun.run is not a function 137 | ... 138 | ``` 139 | 请 cd 到您新建的项目中去在尝试 140 | 141 | **mac/linux:** 142 | 正常来说 mac/linux 下不会有任何报错,如果提示权限不足请 sudo 执行。 143 | 144 | **windows** 145 | 如果报权限不足,如果 dev.json 未做修改,默认是80端口,请找出80端口占用程序并关闭他。 146 | 147 | 如果报了以下错误: 148 | > vue packages version mismatch 149 | 150 | 请全局安装 weex-toolkit,并运行: 151 | ``` 152 | weex repair 153 | ``` 154 | 155 | ## Q: 为什么我当前打出来的 js bundle 会这么大 156 | 157 | A: 158 | 目前脚手架中正在集成 tree-shaking,因为官方也并未使用 tree-shaking 来优化包体积,所以需要一定时间。 159 | 160 | 目前可以先这么优化: 161 | ``` 162 | // 当前: 163 | import {buiButton} from 'Eros/bui' 164 | 165 | // 改为: 166 | import buiButton from 'Eros/bui/components/buiButton' 167 | ``` 168 | 169 | 这样能明显减少包体积大小。 170 | 171 | ## Q: iOS资源下载慢,或者等待时间巨长(eros install ios 命令) 172 | 173 | A: 174 | 175 | 执行 `eros install ios` 命令后会从 git 上加载iOS工程所需要的三方SDK,由于网络原因,或者是墙的原因一些资源加载巨慢,甚至会加载失败如下图: 176 | 177 | ![](./image/iosInstallError.jpeg) 178 | 179 | **解决方法**:从 https://github.com/xiaohuapunk/WeexEros3Rd 仓库将里面的资源文件下载到本地,并拷贝到 (你的工程目录)/platforms/ios/WeexEros 中,然后再次执行`eros install ios`命令即可; 180 | 181 | ## Q: IOS模板工程无证书真机调试 182 | 183 | A: 184 | 185 | > 自 Xcode7 版本之后,苹果爸爸允许开发者无证书真机调试(跟有证书的还是存在一些差异的,很多功能都是用不了的,比如推送),简单几步就可以实现无证书真机调试; 186 | 187 | ##### 1.注册个人AppleID 账号 188 | 189 | - 登录开发者后台(https://developer.apple.com/) 注册一个AppleID,如果之前有账号(就是下载app登录的那个账号)登录进去,同意一下条款即可; 190 | 191 | - 在Xcode账号设置中,添加账号 192 | 193 | ![](./image/addAccounts.png) 194 | 195 | ##### 2.无证书真机调试需要先关闭 `Push Notifications` 功能;不然的话就会报下面的错误提示👇 196 | 197 | > 我们的模板开启了推送功能,所以需要先将这功能关闭,个人账号是没有这功能的 198 |
199 | 200 | ![](http://ww4.sinaimg.cn/large/0060lm7Tly1fmlbm99iibj30i40amjt1.jpg) 201 | 202 | 解决办法: 203 | 204 | - 修改 Bundle Identifier 注:需要修改成别人没有用到过,苹果会验证唯一性 205 | 206 | ![](http://ww2.sinaimg.cn/large/0060lm7Tly1fmlbugnl9uj313w04m74s.jpg) 207 | 208 | - 修改team,选择 None(需要先将team设置成none) 209 | 210 | ![](http://ww3.sinaimg.cn/large/0060lm7Tly1fmlby2fkcnj313y0cuabw.jpg) 211 | 212 | - 找到 Gapabilities,将 `Push Notitications` 关闭 213 | 214 | ![](http://ww2.sinaimg.cn/large/0060lm7Tly1fmlc0xwiorj31840cqtb6.jpg) 215 | 216 | ##### 3.在将 Team 设置为自己的账户即可 217 | 218 | ##### 升级工程文件 219 | > 更新前记得将工程备份
220 | > 有些更新需要更新工程文件,通过 `instal`更新不到,需要使用 `eros update` 命令;
221 | 222 | 在终端输入 `eros update` 后按提示输入文件的路径即可更新 223 | 224 | 以下是每个文件路径 225 | - install.sh: `/platforms/ios/WeexEros/install.sh` 226 | - Info:`/platforms/ios/WeexEros/WeexEros/Info.plist` 227 | - Podfile:`/platforms/ios/WeexEros/Podfile` 228 | - AppDelegate.m: `/platforms/ios/WeexEros/WeexEros/AppDelegate.m`
229 | 升级完后需要再次执行 `eros install ios` 230 | 231 | ##### 移除ATSDK 232 | `Weex`默认集成了的 `ATSDK 性能监测工具`,`Eros` 中之前也集成了这个sdk,sdk中用到了私有api,会导致审核不通过,Eros 现在已经将其移除,如果你已经使用`Eros`开发了iOS app 下面是移除方法: 233 | 234 | > 2017.12.22 之后初始化的工程不需要此操作 235 | 236 | ##### 1.升级Podfile文件 237 | 238 | - Podfile:`eros update`,path 填写 `/platforms/ios/WeexEros/Podfile`。 239 | 240 | 241 | ##### 2.升级完后需要再次执行 `eros install ios` 242 | ##### 3.修改配置文件 243 | 244 | > 在Xcode中:找到Other Linker Flags 并展开,在`Debug`和`Release`中,移除 `ATSDK`的引用,注意:需要将上面的 `-framework`也一同移除 245 | 246 | ![](./image/removeAtsdk.png) 247 | 248 | ##### 4.重新运行,成功运行起来则说明移除成功了 249 | 250 | ## Q: errCode->wx_network_error msg->Unable to resolve host 'app.weex-eros.com':No address associated with hostname 251 | 252 | A: 253 | 发生这个错误证明您的手机或者模拟器无法连接到您的服务,你需要检查以下情况排查为何无法连接到服务。 254 | 1. 确认服务是否开启,可以访问服务如:app.weex-eros.com:8889 (如果端口没有或者不一样需要对应修改)。 255 | 2. 如电脑可以正常访问,那么请使用手机浏览器访问继续查看。 256 | 3. 如果手机浏览器无法访问,那么您可能需要连接代理。 257 | 4. 如果设置代理以后还是无法访问,请确认代理是否设置成功,您可以尝试用手机访问下百度,是否可以访问,并且代理抓包成功。 258 | 5. 如果您不想设置代理,可以尝试在手机浏览器里直接用ip(如果有端口记得加上)访问您的服务,如果可以直接访问成功的话。 259 | 您可以将eros-demo/config/eros.native.js 文件里 jsServer 字段改成您的 ip (如果有端口记得加上)。 260 | 然后请重新pack运行 Android程序 261 | 262 | 263 | ## Q: Android 如何修改包名(同一个手机可以跑2个eros 项目)。 264 | 265 | A: 修改gradle.properties 文件 APPLICATION_ID (gradle.properties 文件在项目的跟目录)。 266 | 修改完了请记得 点击 sync now 同步下 267 | 268 | 269 | ## Q: Failed to resolve: com.android.support:appcompat 270 | ``` 271 | Failed to resolve: com.android.support:appcompat-v7:25.3.1 272 | Add Google Maven repository and sync project 273 | Show in File 274 | Show in Project Structure dialog 275 | ``` 276 | A: 这时候您可以直接点击 Add Google Maven repository and sync project 等待编译完成即可 277 | 278 | ## Q: 如何实现安卓的finish 279 | 280 | A: 281 | 282 | 1.注册两个属性curHomeBackTriggerTimes: 1, 283 |     maxHomeBackTriggerTimes: 2,//代表按几次退出APP。 284 | 2.实现方法 285 | ``` 286 | //安卓自定义退出APP 287 | androidFinishApp() { 288 | const globalEvent = weex.requireModule("globalEvent"); 289 | globalEvent.addEventListener("homeBack", options => { 290 | this.curHomeBackTriggerTimes === this.maxHomeBackTriggerTimes && 291 | this.$router.finish(); 292 | 293 | this.$notice.toast({ 294 | message: `点击返回${ 295 | this.maxHomeBackTriggerTimes 296 | }次之后,会关闭应用,当前点击第${this.curHomeBackTriggerTimes}次` 297 | }); 298 | this.curHomeBackTriggerTimes++; 299 | }); 300 | } 301 | 302 | ``` 303 | 304 | 3.在created中调用此方法 305 | 306 | ## Q: 导入项目后提示`android.enableAapt2 xxxxx`错误 307 | 308 | A: 309 | 出现此类问题主要是AS在导入项目是用了新版本gradle编译插件造成的。eros官方目前推荐且默认使用的gradle版本为4.1,gradle plugin版本为3.0.0。如果你不小心升级了版本,可按照如下操作设置版本。 310 | 311 | 1. 312 | ![步骤1](https://bmfe.github.io/eros-docs/zh-cn/image/modify_gradle_verison.jpg) 313 | 314 | 2.点击右上角SynNow按钮同步项目。 315 | 316 | ## Q: 使用 weex-amui 317 | 318 | A: 319 | 1. 安装 `weex-amui` 320 | ```shell 321 | npm install --save weex-amui 322 | ``` 323 | 2. 修改 `.babelrc` 文件, plugins => import 下添加: 324 | ```json 325 | { 326 | "libraryName": "weex-amui", 327 | "libraryDirectory": "packages", 328 | "style": false 329 | } 330 | ``` 331 | 3. 使用 332 | ``` 333 | import { AmButton } from 'weex-amui' 334 | ``` 335 | ## Q: bmchart添加热力图 336 | A: 337 | ### 申请百度地图AK 338 | 1、 访问并登录[百度地图开放平台][1]。 339 | 340 | 2、 创建应用。 341 | ![](https://ws1.sinaimg.cn/large/9290cd97gy1ftjvdx3wivj20p90a20ud.jpg) 342 | 343 | 3、 完善应用信息。 344 | ![](https://ws1.sinaimg.cn/large/9290cd97gy1ftjvgjv7enj20hm0grgoq.jpg) 345 | 346 | 4、按照要求提交后会自动生成应用及AK值。 347 | ![](https://ws1.sinaimg.cn/large/9290cd97gy1ftjvk6mc6mj209r0540t4.jpg) 348 | 349 | ![](https://ws1.sinaimg.cn/large/9290cd97gy1ftjvl3ibx4j20h207lab1.jpg) 350 | 351 | ### 下载所需[bmap.min.js][2]文件。 352 | github: [echarts的地图扩展][3] 353 | 354 | ### 存放html及相应js文件 355 | 356 | 1、将eros内置的bm-chart.html及echarts.min.js文件拷贝,与下载的bmap.js一起放置到assets文件夹下,如下图所示 357 | ![](https://ws1.sinaimg.cn/large/9290cd97gy1ftzp2e4p5gj205u03lq31.jpg) 358 | 359 | 2、修改bm-chart.html文件,将其中的js路径修改为相对路径并添加百度地图的jssdk路径及bmap的路径,如下图所示 360 | ![](https://ws1.sinaimg.cn/large/9290cd97gy1ftzp40miwqj20ku034dgw.jpg) 361 | 362 | ### 数据样例格式 363 | 写法与[eros文档][4]所述一致,只需按照[echarts官网样例][5]配置参数即可。 364 | 365 | ![](https://ws1.sinaimg.cn/large/9290cd97gy1ftjwalxnf6j20cp0bmdgv.jpg) 366 | 367 | [1]:http://lbsyun.baidu.com/ "百度地图开放平台" 368 | [2]:https://github.com/apache/incubator-echarts/blob/master/dist/extension/bmap.min.js "bmap.min.js" 369 | [3]:https://github.com/apache/incubator-echarts/tree/master/extension/bmap "echarts的地图扩展" 370 | [4]:https://bmfe.github.io/eros-docs/#/zh-cn/eros_widget "eros文档" 371 | [5]:http://echarts.baidu.com/examples/editor.html?c=heatmap-bmap "heatmap样例" 372 | 373 | ### bmchart引入bm-chart.html文件 374 | 375 | -------------------------------------------------------------------------------- /zh-cn/README.md: -------------------------------------------------------------------------------- 1 | 2 | # 介绍 3 | **eros 是基于 [weex](https://weex-project.io/cn/) 封装面向前端的 vue 写法的解决方案,由于 app 开发的特殊性,eros 则更偏重关心于整个 app 项目。** 4 | 5 | 8 | 9 | | iOS download QR code | Android download QR code | 10 | |---------|---------| 11 | |![ios下载](https://bmfe.github.io/eros-docs/zh-cn/image/iosqr.png)|![android 下载](http://upload.ouliu.net/i/201801241911376ee1z.png)| 12 | 13 | * [iOS 下载链接](http://fir.im/eros) 14 | * [Android 下载链接](https://fir.im/weexerosandroid) 15 | 16 | 17 | > 开发者可以扫描二维码来下载 eros app 来进行体验,iOS首次打开App需要在 **设置->通用->设备管理 信任开发证书。** 18 | 19 | # 开发之前你需要知道 20 | **如果您是前端开发者:** 21 | * 一定要熟练使用 vue 开发 22 | * 一定要详细阅读 weex 的文档,尤其是与 web 环境,vue 开发差异的部分。 23 | * 在开发客户端应用中,会有遇到无数的环境问题,程序问题,代码问题,绝大多数问题都可以在网上查到对应解决方案,在提出问题或者 issue 的时候,还请先自行尝试解决,eros 的环境安装会耗费很长的时间,你懂的。 24 | * 需要熟悉客户端开发打包流程。 25 | 26 | > 很多前端开发者在环境问题上便半途而废了,不过 eros 会一直完善文档,开发群中也会有大量开发者为您解答,还请保持一颗有始有终的心,会有收获的。 27 | 28 | **如果您是客户端开发者:** 29 | 30 | 那么环境您会迅速搭建起来,然后跟着熟读 vue,weex 的文档,因为 vue 上手非常快,最后跟着 eros 的新手教程写几个 demo 便可以开始开发,还可以轻松拓展 module。 31 | 32 | # 必备知识 33 | 开发之前您需要学习 weex 知识,并且能熟练使用 vue 开发,文档地址如下。 34 | * [weex](http://weex.apache.org/cn/guide/) 35 | * [vue](https://cn.vuejs.org/v2/guide/) 36 | 37 | # 支持性 38 | > 跟随着 weex 的支持性,`但目前我们并不支持开发代码兼容 web 端` 39 | 40 | * Android 4.1 (API 16) 41 | * iOS 8.0+ 42 | * WebKit 534.30+ 43 | 44 | # eros 优点 45 | eros 提供了: 46 | * 详细的文档来解决环境搭建过程中的坑。 47 | * 一套代码编译成 ios,android 两端原生应用。 48 | * 封装了大量 weex module,让前端开发方便进行原生的操作。 49 | * 支持大量 `echart` 实例运行。 50 | * 可以通过 `appboard` 机制来减少多页面项目中的代码冗余,减少包体积,并可以对其实时修改。 51 | * 内置了一套完整的 JS 二次封装 module (widget) ,直接通过 vue 插件系统注入,直接在 `this` 上调用,可根据业务自行修改。 52 | * 内置了中介者服务,来进行多个页面间的交互,并可以管理业务。 53 | * 内置了服务器端增量发布更新逻辑,可以搭配着开源的简易增量发布系统一起使用。 54 | * 支持真机和模拟器通过 `weex debug` 来断点调试,程序报错均会有报错日志弹窗提示。 55 | 56 | 可以通过脚手架: 57 | * 直接生成开发最新模板。 58 | * 启动服务进行实时开发效果查看和 debug 调试。 59 | * 更新开发平台所需 eros 依赖。 60 | * 直接 `pack` 对应平台内置 `JS Bundle`。 61 | * 支持生成全量包,增量包,并内置与更新服务器交互逻辑。 62 | * 支持同步更新模板内容。 63 | * 支持 weex 的 vue 入口和 js 入口两种开发方式。 64 | 65 | 支持市面上流行的组件库: 66 | * [weex-ui](https://github.com/alibaba/weex-ui) ( 阿里出品,推荐使用 ) 67 | * [bui](https://github.com/bingo-oss/bui-weex) 68 | 69 | # eros 不足 70 | > eros 开发中也有很多限制,需要开发者自行斟酌。 71 | 72 | * 尽管 weex 支持编译三端,**但 eros 目前不支持浏览器端**,目前只会专注于原生。 73 | * eros 暂时不能自动使用 weex 市场,但如果您有原生开发经验可以自行接入。 74 | * 由于 eros 对 **JS Bundle** 运行机制采用了 appboard 机制来减少了 js bundle 的大小,导致 weex debug 需要特定的处理。 75 | * 如果遇到复杂的页面,如 IM 之类的,eros 建议用原生实现,weex 应付此类需求还是比较吃力。 76 | 77 | # 原理视图 78 | 79 | ![工作原理](http://on-img.com/chart_image/59c5d743e4b0d34a18d69580.png) 80 | [大图地址](http://on-img.com/chart_image/59c5d743e4b0d34a18d69580.png) 81 | 82 | # 开源现状 83 | 目前 `eros` 已有数十个 app 在开发中和上线的状态,其中有正在开发中的国外应用 **starLife(100+页面)**,也有国内正在开发的**蜂觅(60+ 页面)**,还有**已上线的应用都在 0-50+ 页面不等**,涉及行业分布于资讯,医疗,招商,购物,政府,办公等等。 84 | 85 | 而本木医疗(京医通)技术团队本身也基于 weex 开发了三个已上线的 app,均可在苹果商店和应用宝下载: 86 | * 健康首都(京医通 app版,100+页面,很多功能还未开放) 87 | * 本木医疗助手(30+页面) 88 | * 本木医生助理(20+页面) 89 | 90 | 后续版本中会陆续展示优秀项目到首页,所以开发者大可放心,这不是一个 KPI 项目(公司没有 KPI ),已基于 MIT 协议开源。 91 | 92 | 93 | # 周边系统 94 | | Project | Description | 95 | |---------|-------------| 96 | | [eros-cli](https://github.com/bmfe/eros-cli) | 简单的 eros 项目构建工具,可以提供搭建,开发,调试和发布等功能。 | 97 | | [eros-publish](https://github.com/bmfe/eros-publish) | 简单的服务器差分包更新逻辑,需要和脚手架搭配使用。 | 98 | | [eros-ios-library](https://github.com/bmfe/Benmu-iOS-Library) | eros ios Weex 项目依赖库。 | 99 | | [eros-ios-sdk](https://github.com/bmfe/WeexiOSSDK) | eros ios Weex sdk。 | 100 | | [eros-android-framework](https://github.com/bmfe/WeexErosFramework) | eros weex 移动解决方案安卓端框架。 | 101 | | [eros-android-widget](https://github.com/bmfe/BMWidget) | eros 安卓组件库。 | 102 | | [eros-android-sdk](https://github.com/bmfe/WeexSDK) | eros 安卓移动解决方案安卓端 WeexSDK。 | 103 | 104 | # 社区贡献 105 | * [eros 网易严选](https://github.com/bmfe/eros-yanxuan-demo-v2) 106 | * [weex-eros-book 书籍阅读 app](https://github.com/wennjie/weex-book) 107 | * [lygtq-eros-publish 服务器增量发布逻辑](https://github.com/hodgevk/lygtq-eros-publish) 108 | * [eros-node-server 服务器增量发布逻辑](https://github.com/shawn-tangsc/eros-node-server) 109 | 110 | # 讨论组 111 | eros 正式开源到现在已经有了一个拥有大量开发者的群,群里有大量开发者已经有 eros 产品在开发中和已上线,为了维护一个良好的环境,还请先熟知以下群规: 112 | 113 | * **此并不是流量群,也并非广告群,是为了大家一起成长,保证信息的有效性,如果发黄赌毒,不和谐言语,与学习无关的广告,推广内容,无关小程序,不会商量,直接会被踢,且不会再有入群机会。** 114 | * eros开发中遇到任何问题可以随时发到群里 weex开发相关可以一起讨论。 115 | * 如果不能及时回答也请耐心等待,群里开发丰富经验的同学会帮您一起看问题。 116 | * 除了 eros 自身紧急 BUG 外的问题,均需要提 issue,我们会按 issue 处理,目的是为了更好的给其他开发者参考,紧急问题请直接抛到群里,我们会直接远程帮助您调试。 117 | 118 | QQ群: 119 | 120 | 121 | 122 | # License 123 | [MIT](https://opensource.org/licenses/MIT) 124 | 125 | Copyright (c) 2017-present, 本木医疗 -------------------------------------------------------------------------------- /zh-cn/advanced_appboard.md: -------------------------------------------------------------------------------- 1 | ## 由来 2 | 我们知道 weex 推荐通过多页面的形式来构建我们的应用,那么常见的传统多页面造成的问题自然也需要我们去解决,其中影响最大是就是: 3 | 4 | > 所有页面的公共依赖直接会影响的 bundle 体积 5 | 6 | 100 个页面都依赖某些公共模块 `common.js`,假设 `common.js` 大小是 `10 kb`,如果你拆分的不够细,或者写法不支持 tree shaking,那么你每个页面中都会含有这 `10 kb` 的代码,总大小 `1000 kb`,分析一下: 7 | 8 | > 1000kb = 10kb + 990kb(冗余) 9 | 10 | 我只想要打包体积只增长 `10kb`,不要剩余的 `990kb 冗余`,`appboard` 就是帮你减少冗余的。 11 | 12 | ## 什么是 appboard ? 13 | 我们把 board 翻译成为`寄宿`就会好理解,意思就是我们想寄宿在 app 上,他的本质就是一个 `js bundle`,原理大家也不难猜出: 14 | 15 | > 把这些公共逻辑打成一个 `js bundle`,在客户端执行业务 bundle 之前,执行公共逻辑的 `js bundle` 即可。 16 | 17 | ## 使用 18 | > 我们在开发模板中默认帮你配置了 `公共 js bundle` 为 `src/js/config/index.js`,**一般来说你无需进行以下手动配置,直接使用即可**。 19 | 20 | 1.在 `eros.dev.js` 中配置出你想要成为公共 js bundle 的路径: 21 | 22 | ```js 23 | 'exports': [ 24 | // appBoard 25 | 'js/config/index.js', 26 | ... 27 | ] 28 | ``` 29 | 30 | 2.在 `eros.native.js` 注册,写入 src/js/ 的相对路径。 31 | 32 | ```js 33 | { 34 | ... 35 | 'appBoard': '/config/index.js', 36 | ... 37 | } 38 | ``` 39 | 40 | 3.用上面的例子来说,我只想寄宿这`10kb`,我只需把代码放入 `src/js/config/index.js` 中即可。 41 | 42 | ## 建议 43 | > 聪明的你应该已经发现,我们的 widget 就是这样的方式引入进来的,widget 总共大小有 50 多kb,但每个业务 bundle 中并未冗余。 44 | 45 | 但我们还有几点需要注意的: 46 | - **不要往里面放过多的代码,必定会增加每个 bundle 的解析执行的时间!** 47 | - 我们建议公共代码抽离之后放入 `appboard`,非公共的还是在业务 bundle 中自行引入。 48 | - 而你无需在业务的 `js bundle` 中做类似 `import` 这个 `config/index.js` 的代码,因为我们已经在客户端内帮你拼接了。 49 | - 这里路径相差了个 `js` 字符,先记一下,后续会在优化,保持一致。 50 | -------------------------------------------------------------------------------- /zh-cn/advanced_bindingx.md: -------------------------------------------------------------------------------- 1 | ## bindingx 由来 2 | 3 | 引用官方文档上的介绍: 4 | 5 | * 由于 **weex 底层使用的 JS-Native Bridge 具有天然的异步特性**,这使得 JS 和 Native 之间的通信会有固定的性能损耗,因此在一些复杂的交互场景中,JS 代码很难以高帧率运行。举个例子,如果我们要实现 `视图随手势移动` 的效果,那么按照传统的方式,需要在这个视图上绑定 `touch` 或者 `pan` 事件,当手势发生时, Native 会将手势事件通过 Bridge 传递给 JS , 这产生了一次 Native 到 JS 的通信。而 JS 在接收到事件后,需要根据手指移动的偏移量驱动界面变化,这又会产生一次 JS 到 Native 的通信。**与此同时,手势回调事件触发的频率是非常高的,频繁的通信带来的时间成本很可能导致界面无法在16ms中完成绘制,进而产生卡顿**。 6 | 7 | * 事实上,不仅仅是在 weex 上存在这种问题, React Native 等框架同样存在类似的问题。拿 React Native Animated 组件为例,为了实现流畅的动画效果,这个组件采用了声明式的API,在 JS 端仅仅定义了输入与输出以及具体的 transform 行为,而真正的动画是通过 Native Driver 在 Native 层执行,这样就避免了频繁的通信。然而,这个方案只能解决一部分问题,如果是有复杂交互操作的场景就不够用了。另外,声明式的方式能够定义的行为非常有限,无法满足更复杂的交互场景。 8 | 9 | ## 使用之前 10 | 请熟读官方文档: 11 | 12 | * [bindingx 文档](https://alibaba.github.io/bindingx/guide/cn_introduce) 13 | 14 | 15 | `weex native` 项目的使用过程中需要注意: 16 | 17 | 1.传入的元素需要多取一层 `ref` 属性,假设我们给一个元素上面 `ref` 属性赋值为 `box` ,则使用时候按照以下方式才可: 18 | 19 | ```js 20 | this.$refs.box.ref 21 | ``` 22 | 23 | 2.如果引用方式为 `requireModule('bindingx')` 这种 weex 引入 module 的写法,bind 方法按照文档中的方式是无效的,需要做特殊处理,后面会说到。 24 | 25 | 3.ios 端引入的时候需要做下页面手势返回处理 (eros 中拓展了`$router gesBack` 属性),防止右滑时候出现`手势冲突`。 26 | 27 | ## eros 中使用 28 | 29 | 如果下载官方的 npm 包 `weex-bindingx` 直接使用时没有问题的,但 eros 是主要 focus native,引入 `weex-bindingx` 在打出来一个简单的 JS Bundle 就要 `190+ kb`,很明显有些过于臃肿,在交互复杂的页面,打出来的 JS Bundle 的大小就更加不可控。 30 | 31 | 进入 `weex-bindingx` 源码发现,如果 native 直接使用 `requireModule('bindingx')` 引入,是需要改变 expression 为对象,把填写的表达式值传入对象的 origin 属性,然后传入一个的 `transformed` 属性,这个属性是很长的 CallNative 指令字符串,可以通过下载 npm 包 `bindindx-parser` 来自动生成。 32 | 33 | 于是 eros 做了很简单的二次封装,集成进 `widget` 中,直接通过 `this` 调用即可。 34 | 35 | 下面我们来实现一个官方的 demo: 36 | 37 | ![](/image/advanced_bindingx.gif) 38 | 39 | 40 | 首先编写模板和样式: 41 | 42 | ``` 43 | 62 | 63 | 131 | 132 | ``` 133 | 编写 js 逻辑: 134 | ``` 135 | 242 | ``` 243 | 可以看到,只需要调用 `$bindingx` 即可。 244 | 245 | ## weex native 中使用 246 | **在非 eros 的 weex native 项目中**,我们可以重写 `bind` 方法来保持与官方使用一致,下载 npm 包, `lodash`和 `bindingx-parser` 来进行改造: 247 | 248 | ``` 249 | // bindingx.js 250 | import { parse } from 'bindingx-parser' 251 | import _cloneDeep from 'lodash/cloneDeep' 252 | 253 | const WeexBinding = weex.requireModule('bindingx') 254 | const BindingxFunction = WeexBinding.bind 255 | 256 | let _WeexBinding = _cloneDeep(WeexBinding) 257 | 258 | // 重写 bind 方法 259 | _WeexBinding.bind = (options, callback) => { 260 | if (!options) { 261 | throw new Error('should pass options for binding') 262 | } 263 | 264 | options.exitExpression = formatExpression(options.exitExpression) 265 | 266 | if (options.props) { 267 | options.props.forEach((prop) => { 268 | prop.expression = formatExpression(prop.expression) 269 | }) 270 | } 271 | 272 | return BindingxFunction(options, options && options.eventType === 'timing' ? fixCallback(callback) : callback) 273 | } 274 | 275 | module.export = _WeexBinding 276 | ``` 277 | 在业务中使用: 278 | ``` 279 | var bindingx = require('bindingx') 280 | ``` 281 | 这样在打包之后非压缩状态下体积能减少到 `34kb` 左右。而 eros js bundle 的大小会更小,已经把这部分重写逻辑放入了 `widget`,通过 `appboard.js` 来内置到客户端执行。 282 | 283 | 现在,尽情使用 bindingx 吧! 284 | 285 | 286 | -------------------------------------------------------------------------------- /zh-cn/advanced_diff.md: -------------------------------------------------------------------------------- 1 | > 更新逻辑已开源,使用文档 [eros-publish](https://github.com/bmfe/eros-publish),下面我们说下增量发布的大概实现逻辑。 2 | 3 | ### 需要更新的资源 4 | 5 | weex 的优势之一就是业务发布可以不走 App Store 的审核,能实现业务快速更新,快速落地,需要更新的资源大致分下面几类 6 | 7 | * native 代码部分 8 | * js 业务代码 9 | * 图片、iconfont 等静态资源 10 | 11 | #### native 代码部分 12 | 13 | 苹果之前 对 native 热更新方案进行警告之后,这部分目前希望大家谨慎尝试。 14 | 15 | #### js 业务代码 16 | 17 | 我们认为所有脱离了 native 部分的代码都是业务代码,weex-eros 设计的页面交互是多页面,并不适用 vue-router,配合封装的路由,基本上是一个页面对应一个 js 文件,就像是回到了多年前的多页面时代。但是这带来的原生的页面切换,交互体验好了很多,也一定程度的抹平了初始化渲染的性能问题。这部分代码的更新是一定牵涉业务的,这也是更新包的主要部分。 18 | 19 | #### 图片、iconfont 等静态资源 20 | 21 | 图片部分:图片这块目前没有做打包本地,虽然会有加快一定的渲染速度,但随着业务的变化,这块会增加更新包的大小,有可能更新包里的图片都不会被用户使用,但是还是下载下来了,造成用户流量浪费也增加了更新包的大小,目前的方案是发送请求,图片资源客户端会缓存到本地,二次加载同一张图片就会变快。 22 | 23 | iconfont:如果在样式解释的时候没有找到字体图标文件,字体图标就会找不到,并且 iconfont 请求完成之后不会更新当前视图,所以 iconfont 必须要做增量更新,大小对包的影响不大。所以放在增量包中。 24 | 25 | ### 更新包设计 26 | 27 | 经过上面的分析,我们的更新包包括两部分:js 业务代码和 iconfont。我们目前将这两部分的代码加上一个 md5.json,生成一个 .zip 压缩包。 28 | 29 | md5.json 内容如下: 30 | 31 | ```js 32 | { 33 | // 所有页面对应的 js 文件,用于做单个文件完整性校验 34 | "filesMd5": [{ 35 | "android": "1.0.0", 36 | "iOS": "1.0.0", 37 | "page": "/pages/home/index.js", 38 | "md5": "c2125dfab756dc0e9cfe854a297a0512" 39 | }, { 40 | "android": "1.0.0", 41 | "iOS": "1.0.0", 42 | "page": "/iconfont/iconfont.ttf", 43 | "md5": "50ed903231bcdc851bfde9a0bf565e38" 44 | }], 45 | // 当前 zip 包依赖的最低的安卓版本号 46 | "android": "1.0.0", 47 | // 当前 zip 包依赖的最低的 iOS 版本号 48 | "iOS": "1.0.0", 49 | // 当前这个 appName,用于区分不同 APP 业务的 key 50 | "appName": "demo", 51 | // 当前这个 zip 包的版本号 52 | "jsVersion": "56a4569f271294a05e4ff0f567d332b4", 53 | // 生成当前 zip 包版本号的时间戳 54 | "timestamp": 1489983294137 55 | } 56 | ``` 57 | 58 | filesMd5 中的每一项就是当前这个 zip 包文件中的文件信息,根据每个文件内容会生成一个 MD5 值,当前包的 MD5 值作为当前包的版本号,会根据这个 MD5 进行文件完整性的校验 59 | 60 | 客户端可以根据每一个文件来看下载下来的文件有没有缺失,如果有缺失,这里就需要看策略了,是直接去请求线上最新的这个 js 文件还是重新下载 zip 61 | 62 | ### **如何增量** 63 | 64 | 当出现第一个版本之后,我们就需要考虑每次升级的问题了,我们肯定不希望每次都去下载完整的 zip 包,浪费流量。也不可能实时 diff,这样更新肯定会慢,所以我们想用空间换时间的方式。 65 | 66 | 每生成一次完整的资源包,需要和当前已有的资源包进行一次 diff,生成若干差分包。每次 APP 更新的时候只需要下载差分包就行了。如: 67 | 68 | > * 新版本\(v3\) - 旧版本\(v1,v2\) = 全新的 v3 包、v3-v1 差分包、v3-v2 差分包 69 | > * 然后,APP 根据自己的当前版本,比如 v2,下载对应的增量包 v3-v2。 70 | > * 然后本地进行合并。 v2 完整包 + v3-v2 差分包,得到完整的 v3 新包。 71 | 72 | ### 增量包生成 73 | 74 | zip 包的生成依赖的是 bsdiff,这个需要本地装一个 bsdiff 75 | 76 | ```js 77 | // 命令行生成差分包命令: 78 | bsdiff oldZip newZip diffZip 79 | //命令行合并差分包命令: 80 | bspatch oldZip diffZip newZip 81 | ``` 82 | 83 | 生成的 diffZip 包命名可以有一些命名的算法,这样的命名在存储的时候就不需要存差分包和完整包的映射 了。 84 | 85 | 在生成差分包时需要指定所有完整的包目录,在 demo 中 config.js 有对应的配置,每次发布都会将完整的 zip 放在 打包机上,每次都会和留下的这些完整的包进行对比生成差分包。 86 | 87 | 至此,我们的打包工作就完成了 88 | 89 | ### 增量发布流程设计![](/assets/3dd2d0e046ea585f7ef5fd133170b9e8.jpg) 90 | 91 | #### 服务器支持 92 | 93 | 增量包生成完成之后会生成一个 version.json 文件,并将文件内容上传至服务器,服务器存下版本,下次返回客户端是否需要更新的凭证。下面是 version.json 的具体内容,服务器存下多个版本之后就可以对客户端每次是否需要更新进行回复。 94 | 95 | 发布地址配置在 config.js 中有对应的配置,这里主要说明一下后端的逻辑。 96 | 97 | ```js 98 | { 99 | // 当前 zip 包依赖最低安卓版本 100 | "android": "1.0.0", 101 | // 当前 zip 包依赖最低 iOS 版本 102 | "iOS": "1.0.0", 103 | 当前这个 appName,用于区分不同 APP 业务的 key 104 | "appName": "demo", 105 | // 当前 zip 包的版本号 106 | "jsVersion": "cd34091af113f98c2cbf4d81131ccdde", 107 | // 生成版本号时的时间戳 108 | "timestamp": 1489997936509, 109 | // 对应的静态资源服务器的地址 110 | "jsPath": "https://xxx.xxx.com/app/" 111 | } 112 | ``` 113 | 114 | ### 检测更新场景 115 | 116 | 增量更新包管理,可以以 当前客户端版本号+当前客户端版本能使用的最新压缩包版本号 进行 md5,这样的管理方式,后端和资源包能解耦关系,更好的维护版本包。 117 | 118 | #### 客户端请求参数 119 | 120 | ```js 121 | 请求参数: 122 | 123 | { 124 | // 当前客户端版本号 125 | "android[or iOS]": "1.0.0", 126 | // 当前 APP 业务的名称 127 | "appName": "demo", 128 | // 当前 zip 包的版本号 129 | "jsVersion": "cd34091af113f98c2cbf4d81131ccdde", 130 | // 是否需要差分包,如果是 false 则返回完整的 zip 包,完整 zip 包多用于特殊情况 131 | "isDiff": true 132 | } 133 | ``` 134 | 135 | 后端对更新逻辑的判断 136 | 137 | ```js 138 | 必传参数:appName、iOS/android 139 | 步骤1: 140 | 查询库里当前的 appName 和 iOS/android 版本号相同的数据 141 | 无结果:返回固定错误码,错误信息 未查询到更新版本信息 142 | 有结果:继续下一步 143 | 步骤2: 144 | 查询库中客户端传过来的 appName、iOS/android、jsVersion 的数据 145 | 无结果:返回需要更新,isDiff = false,返回当前 jsPath:jsPath + jsVersion + '.zip' 146 | 有结果:比对当前 147 | 148 | 查询当前 appName 和 iOS/android 值相同的 (timestamp 最大的 jsVersion) 149 | 150 | 判断 isDiff 的值 151 | false:判断客户端传的 jsVersion 和 (timestamp 最大的 jsVersion) 152 | 相等:返回无需更新 153 | 不相等:返回需要更新,isDiff = false,jsPath:jsPath + jsVersion + '.zip' 154 | true:判断客户端传的 jsVersion 和 (timestamp 最大的 jsVersion) 155 | 相等:返回无需更新 156 | 不相等:返回需要更新 isDiff = true,jsPath:jsPath + md5(客户端传的 jsVersion + (timestamp 最大的 jsVersion)) + '.zip' 157 | ``` 158 | 159 | #### 更新场景1 160 | 161 | 发布了新版本,需要更新,这也是最常见的更新场景。发送请求参数如下: 162 | 163 | ```js 164 | { 165 | // 当前客户端版本号 166 | "android[or iOS]": "1.0.0", 167 | // 当前 APP 业务的名称 168 | "appName": "demo", 169 | // 当前 zip 包的版本号 170 | "jsVersion": "cd34091af113f98c2cbf4d81131ccdde", 171 | // 是否需要差分包,如果是 false 则返回完整的 zip 包,完整 zip 包多用于特殊情况 172 | "isDiff": true 173 | } 174 | ``` 175 | 176 | 接口返回场景1 177 | 178 | 当前 jsVersion 在数据库中不存在,这种情况下无法生成差分包,也有可能是包的信息被篡改了,此时返回需要更新,并返回完整的更新包地址,客户端不做差分合并 179 | 180 | ```js 181 | { 182 | // 此次请求有没有问题 183 | "resCode": 0, 184 | // 此次请求描述 185 | "msg": "当前版本已是最新,不需要更新", 186 | // 回溯的数据 187 | "data": { 188 | // 表示这是一个完整的包 189 | "diff": false, 190 | // 完整包的地址 191 | "path": "https://xxx.xxx.com/app/cd34091af113f98c2cbf4d81131ccdde.zip" 192 | } 193 | } 194 | ``` 195 | 196 | 接口返回场景2 197 | 198 | 当前 jsVersion 在数据库中存在,当前客户端版本号下,jsVersion 已经是最新的,不需要更新 199 | 200 | ```js 201 | { 202 | // 此次请求有没有问题 203 | "resCode": 1000, 204 | // 此次请求描述 205 | "msg": "当前版本已是最新,不需要更新", 206 | // 回溯的数据 207 | "data": {} 208 | } 209 | ``` 210 | 211 | 接口返回场景3 212 | 213 | 当前 jsVersion 在数据库中存在,当前客户端版本号下,jsVersion 还有更新的版本,获取差分包,进行合并再解压。 214 | 215 | 服务端查询当前库中最新的版本号,得到差分包的下载地址并返回。 216 | 217 | ```js 218 | { 219 | // 此次请求有没有问题 220 | "resCode": 0, 221 | // 此次请求描述 222 | "msg": "当前版本已是最新,不需要更新", 223 | // 回溯的数据 224 | "data": { 225 | // 当前下载的 js 的 verison 226 | "jsVersion": "cd34091af113f98c2cbf4d81131ccdde", 227 | // 表示这是一个完整的包 228 | "diff": true, 229 | // 完整包的地址 230 | "path": "https://xxx.xxx.com/app/cd34091af113f98c2cbf4d81131ccdde.zip" 231 | } 232 | } 233 | ``` 234 | 235 | 接口返回场景4 236 | 237 | 当前 jsVersion 在数据库中存在,当前客户端版本号下,jsVersion 还有更新的版本,但是获取差分包失败,这个情况下客户端会重新发起一个请求,获取当前客户端版本号下完整的 zip 包 238 | 239 | #### 更新场景2 240 | 241 | 本地不存在包,或者校验包的完整性发现 zip 包有问题时,直接请求最新的 zip 包。 242 | 243 | ```js 244 | { 245 | // 当前客户端版本号 246 | "android[or iOS]": "1.0.0", 247 | // 当前 APP 业务的名称 248 | "appName": "demo", 249 | // 是否需要差分包,如果是 false 则返回完整的 zip 包,完整 zip 包多用于特殊情况 250 | "isDiff": false 251 | } 252 | ``` 253 | 254 | 接口返回场景1 255 | 当前 jsVersion 在数据库中不存在,这种情况下无法生成差分包,也有可能是包的信息被篡改了,此时返回需要更新,并返回完整的更新包地址,客户端不做差分合并 256 | 257 | ```js 258 | { 259 | // 此次请求有没有问题 260 | "resCode": 0, 261 | // 此次请求描述 262 | "msg": "当前版本已是最新,不需要更新", 263 | // 回溯的数据 264 | "data": { 265 | // 表示这是一个完整的包 266 | "diff": false, 267 | // 完整包的地址 268 | "path": "https://xxx.xxx.com/app/cd34091af113f98c2cbf4d81131ccdde.zip" 269 | } 270 | } 271 | ``` 272 | 273 | 274 | 275 | -------------------------------------------------------------------------------- /zh-cn/advanced_mediator.md: -------------------------------------------------------------------------------- 1 | # 由来 2 | 在传统多页面中,各个页面之前的交互几乎很少,都通过 `url 传参`或者`本地存储`等简单的方式来进行交流,而像 weex 这样把整个 app 都当做一个多页面来处理显然是不太合理的。 3 | 4 | 我们需要一个全局的地方,常驻内存,不被销毁 5 | 举个例子,app 个推推送过来,你要在无论当前在哪个页面都想弹出一个 toast,weex 中你需要在每个页面都写这个公共逻辑。 6 | 7 | > 这样当你有 100 个页面,你就注册了 100 个监听个推回调的事件。 8 | 9 | 而我们期望只监听一次这个事件,然后执行即可,所以 mediator 就出现了: 10 | 11 | > mediator 中介者,本质是个 JS bundle,在程序最开始实例化常驻在内存中,不被销毁。 12 | 13 | ## 使用 14 | > 我们在开发模板中默认帮你配置了 `公共 js bundle` 为 `src/js/mediator/index.js`,**一般来说你无需进行以下手动配置,直接使用即可**。 15 | 16 | 1.在 `eros.dev.js` 中配置出你想要成为公共 js bundle 的路径: 17 | 18 | ```js 19 | 'exports': [ 20 | // mediator 21 | 'js/mediator/index.js', 22 | ... 23 | ] 24 | ``` 25 | 26 | 2.在 `eros.native.js` 注册,写入 src/js/ 的相对路径。 27 | 28 | ```js 29 | { 30 | ... 31 | 'mediator': '/mediator/index.js', 32 | ... 33 | } 34 | ``` 35 | 36 | 3.用上面的例子来说,我们把监听个推的事件代码放入 `src/js/mediator/index.js` 中即可。 37 | 38 | 注意: 39 | - 每次修改之后需要重启 app 才可以看到变动。 40 | - 中介者中试用 weex dom 无效,因为没有页面。 41 | - 中介者与其他页面交互需要通过`发布订阅`。 -------------------------------------------------------------------------------- /zh-cn/advanced_publish.md: -------------------------------------------------------------------------------- 1 | >时间就是金钱,热更新能避免 appStore 的审核,为 app 迭代提供强大动力。 2 | 3 | ## Git 地址 4 | > [https://github.com/bmfe/eros-publish](https://github.com/bmfe/eros-publish) 5 | 6 | ## 开始之前 7 | 本章内容会与开发者一起在`本地构建热更新服务`,开始本章内容前,请再次确保您已经运行起 eros 开发的整套流程,**如果需要构建到服务端/自动构建平台上,我们建议您先了解一些后端基础,在尝试构建 `热更新`**。 8 | 9 | ## eros 为什么要做自己的热更新? 10 | 如果您之前熟读了我们的[入门指南](https://bmfe.github.io/eros-docs/#/zh-cn/tutorial_newcomer),大概就理解为什么 eros 要做`内置包热更新`,这里在列举一下。 11 | 12 | **相对于 weex 每次都走线上请求最新的 bundle,我们做内置包的设计是考虑到如下场景:** 13 | 14 | 1.发布了新页面。 15 | 16 | - weex 场景:新的页面,不做自身缓存策略的话,会加载远端的 bundle,首次加载会很慢,这样页面就会出来的比较慢。 17 | - eros 场景:客户在使用中还是访问老的页面,下次进入 app 更新访问新的,每次从本地读取 bundle,很快。 18 | 19 | 2.bundle 打包体积。 20 | 21 | - weex 场景:weex 推荐多页面,所以每个页面都是个 bundle,意味着使用时候如果不做特殊处理,按需引入,每个 bundle 会有很多重复的冗余代码,尽管 weex 相比 rn,bundle 的体积已经小很多了。 22 | - eros 场景:weex 在本地有一个公共的 js bundle (appboard),我们把公共逻辑都放入这里,每次打包都打一份代码,并把公共代码在客户端来进行拼接这行,虽然这样不太规范,**但这样的方式使我们的 bundle 大小减少了 60% +,100 多个页面,内置包大小仅仅为 2MB**。 23 | 24 | 3.用户在挂号这条业务线中走到了支付这一步,挂号流程改造,支付的时候多加了些参数。 25 | 26 | - weex 场景:发布了新的版本,如果没有做好自身的缓存兼容逻辑,支付页面跳转了新的页面,前端就每次都需要考虑兼容版本之间兼容。 27 | - eros 场景:客户端本地更新了最新的内置包,不会立即更新,用户完成此次 app 使用,下次进入 app 时才会提示更新。 28 | 29 | 4... 30 | 31 | 我们还能列出许多相似的场景,不难看出,内置包热更新的设计,更适于纯 weex native 的项目。 32 | 33 | ## 模拟 EROS 热更新 34 | ### 环境 35 | - node > 7.x.x 36 | - mongoDB > v3.4.9 37 | 38 | ### 工具 39 | - supervisor 开发 40 | - pm2 部署 41 | - Robo 3T (mongoDB 可视化工具) 42 | 43 | 安装都比较简单,装到全局即可,不过多赘述。 44 | 45 | ### clone 项目 46 | ``` 47 | $ git clone https://github.com/bmfe/eros-publish.git 48 | $ cd eros-publish/server 49 | $ npm i 50 | ``` 51 | ### 修改配置 52 | ``` 53 | // eros-publish/server/config.js 54 | module.exports = { 55 | db:'mongodb://localhost:27017/app', 56 | defaultPort: 3001, 57 | staticVirtualPath: '/static', 58 | staticRealPath: '/Users/yangmingzhe/Work/opensource/', 59 | 60 | zipReturn: 'diff' 61 | } 62 | ``` 63 | - `db`: 数据库服务地址 64 | - `defaultPort`: 热更新服务默认端口 65 | - `staticVirtualPath`: 静态虚拟地址 66 | - `staticRealPath`: 静态真实地址 67 | - `zipReturn`: 返回包的开关,`full` 是任何情况下都返回`全量包`, `diff` 则是任何情况下都返回`增量包` 68 | 69 | 这里说下 `staticVirtualPath` 和 `staticRealPath`,拿上面例子来说,访问虚拟地址 ('/static') ,其实是访问的真实地址 ('/Users/yangmingzhe/Work/opensource/') 下的资源。 70 | 71 | > http://localhost:3001/static => /Users/yangmingzhe/Work/opensource/ 72 | 73 | 所以当我们把自己的项目放到 opensource 下,就可以让别人通过`/static` 访问到你项目中的打包生成好的资源文件 `(dist)`。 74 | ### 开发调试 75 | 76 | - 开启数据库: 77 | 权限不足用sudo 78 | ``` 79 | $ mongod 80 | ``` 81 | 82 | - 打开 `Robo 3T` 可视化工具: 83 | 84 | 这时候会提示你链接到你的数据库,链接即可。 85 | 86 | - 运行后端服务 87 | ``` 88 | $ supervisor app.js 89 | ``` 90 | 看到如下界面后: 91 | 92 | 后端已经调通了。 93 | 94 | ### 接口 95 | 总共就 3 个接口,需要我们先熟悉一下: 96 | * 发布列表 97 | * path: `/app/list` 98 | * method: `GET` 99 | * params: 100 | * appName: app名称 101 | * 增加发布记录 102 | * path: `/app/add` 103 | * method: `POST` 104 | * params: 105 | * appName: { type: **String**, require: **true**, desc: **"app 名称"**}, 106 | * jsPath: { type: **String**, require: **true**, desc: **"js bundle 下载路径,也就是 eros.dev.js 中的 diff.proxy"**}, 107 | * iOS: { type: **String**, require: **true**, desc: **"ios 版本号"**}, 108 | * android: { type: **String**, require: **true**, desc: **"android 版本号"**}, 109 | * jsVersion: { type: **String**, require: **true**, desc: **"当前 bundle 的 md5 值"**}, 110 | * timestamp: {type: **Number**, require: **true**, desc: **"单当前包生成的时间**"} 111 | * 检查是否更新 112 | * path: `/app/check` 113 | * method: `POST` 114 | * params: 115 | * appName: { type: **String**, require: **true**, desc: **"app 名称"**}, 116 | * jsPath: { type: **String**, require: **true**, desc: **"js bundle 下载路径,也就是 eros.dev.js 中的 diff.proxy"**}, 117 | * iOS: { type: **String**, require: **true**, desc: **"ios 版本号"**}, 118 | * android: { type: **String**, require: **true**, desc: **"android 版本号"**}, 119 | * jsVersion: { type: **String**, require: **true**, desc: **"当前 bundle 的 md5 值"**} 120 | 121 | `/app/check`中 ios 和 android 二选一。 122 | 123 | ### 修改模板配置 124 | 1. 这里我们重新生成了一个名叫 eros-demo 的默认项目,在本地 `/Users/yangmingzhe/Work/opensource/` 绝对路径下,注意这个就是我上面填写的 `staticRealPath`。 125 | 2. 修改 eros.native.js 中的 `url.bundleUpdate`,由上面的接口我们能知道,需要 app 进行更新检测的接口是 `/app/check`,所以我们填写 `http://localhost:3001/app/check`即可 126 | 3. 修改 eros.dev.js 中的 diff 对象 127 | * `pwd`: 每次更新的全量包我们都存放到这个地址,这样每次差分包的生成都会遍历这个路径下的全量包生成,建议无论是在本地还是在服务器上,都先建好这个目录,我这里写我本地的路径一个新建的目录`/Users/yangmingzhe/Work/opensource/eros-diff-folder` 128 | * `proxy`: 能被用户访问到的路径,由于上面我们配置了 `staticVirtualPath`,这样我们就能在 `http://localhost:3001/static/` 访问到我们的 eros-demo 项目资源,填写路径为 `http://localhost:3001/static/eros-demo/dist/js/` 129 | 130 | ### 模拟更新 131 | 这里需要用到两条指令: 132 | - `$ eros pack -s url`: 构建全量包,内置到两端成为内置包,并将包信息发送 eros-publish 来记录。 133 | - `$ eros build -s url -d`: 构建最新全量包,遍历 eros.dev.js 下 diff.pwd 历史版本分别生成差分包,并将全量包信息发送服务器 134 | 135 | > 差分包 v1-v2 = md5(全量包 v1 md5 + 全量包 v2 md5) 136 | 137 | 首先我们构建模拟 iOS app v1.0.0 首次发版情况。 138 | 1. 修改业务代码,模拟我们 1.0.0 的功能,添加首页加一行代码: 139 | ``` 140 | 版本 1.0.0 141 | ``` 142 | 143 | 2. 修改 app 版本号为 1.0.0,[iOS 修改方法](https://bmfe.github.io/eros-docs/#/zh-cn/ios_config)。 144 | 3. 修改 `eros.native.json` 里的 `version.iOS` 为 1.0.0。 145 | 4. 执行 `$ eros pack -s http://localhost:3001/app/add`,打内置包,并记录此版本全量包信息。 146 | 5. 正式流程这步就可以提交 appStore 审核了,不过本地调试可以忽略此步。 147 | 6. 运行你的 app,关闭拦截器读取内置包,模拟用户,可以看到首页的 `版本 1.0.0`。 148 | 7. 我们修改本地的代码,如把首页文案变动一下 `版本 1.0.0-build.1`。 149 | 8. 执行 `$ eros build -s http://localhost:3001/app/add -d` 来生成差分包。 150 | 9. 重启 app,你就会发现 app 会弹出更新提示,点击立即更新即可看到文案变更为 `版本 1.0.0-build.1`。 151 | 152 | 至此我们就完成了一次 app 的发布,也就是`热更新`。 153 | 154 | 下面会有同学问,当我 app 逻辑做了变动,升级到了 1.0.1 怎么办呢? 155 | 156 | > 只要理解,**我们每次 app 发版都内置最新的 js bundles 给用户**就行了,继续以上步骤,app 版本和 js 版本都变为 1.0.1 就完成了一次跨版本升级。 157 | 158 | ## 部署 EROS 热更新 159 | 部署只需要启动数据库,然后通过 `pm2/nohup` 来部署即可,注意写好上面涉及到的配置。 160 | ``` 161 | $ sudo nohup mongod & // 后台运行数据库 162 | $ sudo pm2 start app.js // 后台 node 服务 163 | ``` 164 | 165 | ## 最后 166 | eros-publish 是一个非常简单热更新服务逻辑,热更新发布最重要的还是要把脚手架和发布系统结合好,eros-publish 虽然是开箱即用,但有一些不足和改进的方向这里也要提一下: 167 | 168 | - 可以在 app 内置 websocket 与发布系统的 websocket,来实现定时定点,分区分片的更新推送,保证 app 可以进行灰度发布,更有甚者,可以按照用户习性来推送不同版本的全量包。 169 | - 更新的逻辑应该更多样化,分为强制更新,非强制更新,更新说明推送等。 170 | - 当更新包比较大的时候应该考虑断点续传,文件校验性的逻辑,不过以我们一百多个页面的 app 来说,整个全量包也才 2M 多。 171 | 172 | -------------------------------------------------------------------------------- /zh-cn/android_config.md: -------------------------------------------------------------------------------- 1 | # App名称、版本号设置 2 | * 应用名称设置 3 | 4 | 1.打开app/src/main/res/values/strings.xml,找到app_name节点。 5 | 如图![](https://img.benmu-health.com/gitbook/1505443821697.jpg) 6 | 2.修改app_name节点的值为你的应用名字即可。 7 | 8 | * 应用版本设置 9 | 10 | 1.打开app/build.gradle,找到versionName。 11 | 如图![](https://img.benmu-health.com/gitbook/1505457425584.jpg) 12 | 13 | 2.将versionName所对应的版本号修改成你的版本 重新运行即可 14 | 15 | # App 图标替换 16 | 17 | 项目的`/platforms/android/WeexFrameworkWrapper/app/src/main/res`目录下 有 mipmap 18 | 如下图![](https://raw.githubusercontent.com/myliuyx/source/master/8011AB9FE2D34C066BA1D4C29652CCD3.jpg) 19 | 20 | 请分别 替换掉 mipmap-hdpi 到mipmap-xxxhdpi 里面的 ic_launcher.png 图片为您app 图标文件。保持命名一样即可。 21 | 22 | > mipmap-hdpi 到 mipmap-xxxhdpi 分别对应的是安卓手机的分辨率 分别从低分辨率到高分辨率不同的图片尺寸。 23 | 您的图标尺寸可以直接参考 目录里已有的图标尺寸 24 | 25 | 26 | -------------------------------------------------------------------------------- /zh-cn/android_env.md: -------------------------------------------------------------------------------- 1 | 写在前面: 2 | * 请确保您已经将[基础环境](https://github.com/bmfe/eros/wiki/%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA)搭建完成 3 | 4 | 初始化一个eros项目: 5 | ``` 6 | $ eros init 7 | ``` 8 | 更新Android 所需要的依赖库 9 | ``` 10 | $ cd eros-demo //进入您刚刚初始化的目录 (此处以 eros-demo 为例) 11 | $ eros install --android // 这里不要使用sudo 权限,否则项目可能无法运行 12 | ``` 13 | > 如果您看见 依赖库更新完成 则证明您已经安装好了依赖。 14 | 15 | ### 好了依赖已经安装完成下面开始导入项目: 16 | 1.点击AndroidStudio上方的**File--->New--->Import Project。** 17 | 18 | ![](https://img.benmu-health.com/gitbook/1505963461481.jpg) 19 | 2.找到eros在你本地的地址,选择**platforms/android/WeexFrameworkWrapper**,点击**OK。** 20 | 21 | ![](https://img.benmu-health.com/gitbook/1505963624252.jpg) 22 | 3.待项目构建完成,点击AndroidStudio上方工具栏的**Run**,即可运行项目。![](https://img.benmu-health.com/gitbook/1505963683163.jpg) 23 | 24 | > 可能您第一次构建的时间太长您也可以尝试[解决Android Studio第一次导入项目太慢](https://www.jianshu.com/p/ba8189146a6b)。实在不行就请耐心等待Android Studio 自己构建完成吧 25 | 26 | > 如果您并不能成功的运行起来,您可以尝试去后面看看[常见问题](https://github.com/bmfe/eros/wiki/Android%E7%9B%B8%E5%85%B3)。 27 | 28 | ### 如果您已可以看见页面了,其实它是一些本地的页面,如果你想尝试连接远端页面。 29 | * 启动服务 30 | ``` 31 | $ cd eros-demo //进入您刚刚初始化的目录 (此处以 eros-demo 为例) 32 | $ sudo eros dev 33 | ``` 34 | 35 | * 点击手机上的调试按钮->调试页面->拦截器开关 下面的CheckBox 对勾关咯就可以连接远端页面, 36 | 远端页面在Android 项目 app/assets目录下 eros.native.json 文件里配置。 37 | 38 | ``` 39 | "url": { 40 | "request": "http://app.weex-eros.com", 41 | "jsServer": "http://app.weex-eros.com", 42 | "image": "https://lev-inf.benmu-health.com/test/xxx", 43 | "bundleUpdate": "http://localhosts:3001/app/check" 44 | } 45 | ``` 46 | >如果您的网络无法直接访问您的服务那么你可能需要配置下代理软件,让手机可以直接访问到您的电脑的服务。 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /zh-cn/android_image.md: -------------------------------------------------------------------------------- 1 | # 图片配置 2 | 3 | 此部分教程主要说明如何修改Android中 App logo、启动图(Launchimage)、以及工程中一些用到的默认图片; 4 | 5 | ### APP 图标替换 6 | * 项目的 `/platforms/android/WeexFrameworkWrapper/app/src/main/res` 目录下 有 mipmap 如下图![](https://raw.githubusercontent.com/myliuyx/source/master/8011AB9FE2D34C066BA1D4C29652CCD3.jpg) 7 | 8 | 请分别 替换掉 mipmap-hdpi 到mipmap-xxxhdpi 里面的 ic_launcher.png 图片为您app 图标文件。保持命名一样即可。 9 | 10 | > mipmap-hdpi 到 mipmap-xxxhdpi 分别对应的是安卓手机的分辨率 分别从低分辨率到高分辨率不同的图片尺寸。 11 | 您的图标尺寸可以直接参考 目录里已有的图标尺寸 12 | 13 | ### APP启动图替换 14 | 15 | * 项目的 `/platforms/android/WeexFrameworkWrapper/app/src/main/res/drawable-xhdpi` 目录下 `ic_splash.png` 文件 16 | 17 | ### 导航栏默认的返回按钮图片 18 | 19 | * 项目的 `/platforms/android/WeexFrameworkWrapper/nexus/nexus/src/main/res/drawable-xhdpi` 目录下 `icon_backnav.png` 20 | 21 | ### image 标签 站位图片,图片加载失败会显示这个站位图 22 | 23 | * 项目的 `/platforms/android/WeexFrameworkWrapper/nexus/nexus/src/main/res/drawable-xhdpi` 目录下 `place_holder.png` 24 | 25 | ### 下拉刷新动画图片 26 | 27 | * 项目的 `/platforms/android/WeexFrameworkWrapper/nexus/sdk/src/main/res/drawable-xhdpi` 目录下 `loadding0001.png` 到 `loadding0028.png` 图片全部替换。 28 | 29 | 30 | -------------------------------------------------------------------------------- /zh-cn/android_pack.md: -------------------------------------------------------------------------------- 1 | ## 基于AndroidStudio打包 2 | 本节介绍一下基于IDE AndroidStudio的不同构建方式和多渠道打包 3 | *** 4 | ### 两种构建方式打包 5 | 构建方式大体分种Debug和Release,Debug一般是用于开发调试的包,eros在debug模式中将保留调试按钮,你可以自由切换资源加载方式。Release是用于对外发布的包,eros在release模式中将隐藏调试按钮,且js资源默认从本地assets中加载。下面简单介绍下发布不同构建方式操作过程。 6 | ### Debug&Release 7 | 1. 选择As菜单栏中build选项,然后选择 Generate Signed APK 8 | ![](https://github.com/aa453509345/eros/blob/master/build.jpg) 9 | 2. 在点击next 10 | ![](https://github.com/aa453509345/eros/blob/master/step1.jpg) 11 | 3. 这一步主要是选择签名信息,ErosDemo中自带了一个测试的签名,你的项目在发布时需要自行创建新的签名文件,签名文件是应用的唯一标示,对于你的应用非常重要。稍后介绍签名文件的生成。 12 | ![](https://github.com/aa453509345/eros/blob/master/step2.jpg) 13 | 4. 选择构建方式和渠道名。构建方式即debug和release,渠道名主要作用是区分不同渠道,这对应用的统计等等非常重要。ErosDemo给出了一个例子渠道,更多自定义渠道请到`platforms/android/WeexFrameworkWrapper/app/build.gradle`中`productFlavors`节点自行添加,更多关于gradle操作请自行google。 14 | ![](https://github.com/aa453509345/eros/blob/master/step3.jpg) 15 | 5. 点击finish开始打包 16 | ### 签名文件的生成 17 | 1. 在上节打包流程中,第二步操作选择create new开始生成签名文件 18 | ![](https://github.com/aa453509345/eros/blob/master/create_1.jpg) 19 | 2. 在弹窗中填写相关信息 20 | ![](https://github.com/aa453509345/eros/blob/master/create_2.jpg) 21 | 主要注意的是签名密码和签名昵称的密码 这个非常重要之后很多操作会用到 一定记到小本本上 22 | 3.点击OK,生成签名文件。签名文件要妥善保管,一旦丢失,泄漏对于之后的发布会造成一些麻烦 23 | 24 | ### Tips:本节简单介绍了签名的生成和打包,上述过程中如果你遇到了麻烦,请issues或者google,让更多的开发者帮助你 -------------------------------------------------------------------------------- /zh-cn/android_plugin_integration.md: -------------------------------------------------------------------------------- 1 | # Android 插件集成方式 2 | 3 | * 从github 上 clone 对应的 插件: 4 | 5 | ``` bash 6 | // 基础库 (2个都是) 7 | git clone https://github.com/bmfe/WeexErosFramework.git "wxframework" 8 | git clone https://github.com/bmfe/eros-nexus.git "nexus" 9 | 10 | // Amap 11 | git clone https://github.com/bmfe/eros-plugin-android-amap.git "ErosPluginAmap" 12 | // 个推 13 | git clone https://github.com/bmfe/eros-plugin-android-getui.git "erosplugingt" 14 | // 微信支付 15 | git clone https://github.com/bmfe/eros-plugin-android-wxpay.git "erospluginwxpay" 16 | // 分享 17 | git clone https://github.com/bmfe/eros-plugin-android-wxshare.git "erospluginumeng" 18 | 19 | ``` 20 | 21 | > 如需要什么插件可直接 复制上面链接 clone 即可。具体版本为Tag,如果您需要使用指定版本的话可以自行切换到指定的Tag 22 | 23 | * 进入Android目录`工程目录/platforms/android/WeexFrameworkWrapper/` 目录下 clone 对应的插件。 24 | 25 | * 打开Android目录`工程目录/platforms/android/WeexFrameworkWrapper/`,编辑`settings.gradle`,添加引入。 26 | 27 | * 打开Android目录`工程目录/platforms/android/WeexFrameworkWrapper/app`,编辑app目录下`build.gradle` 文件 `dependencies` 下添对应 插件引用。 28 | 29 | 30 | > 具体操 `setting.gradle` 和 app 目录下的 `build.gradle` 文件如何 添加引用 请参考下图。 后面也会有个小例子。 31 | 32 | setting.gradle全插件![](https://raw.githubusercontent.com/myliuyx/source/master/plugin_setting_gradle.png) 33 | 34 | 35 | 36 | build.gradle全插件![](https://raw.githubusercontent.com/myliuyx/source/master/plugin_app_gradle_1.png) 37 | 38 | ## 添加基础库插件例子 39 | 40 | * 进入Android目录`工程目录/platforms/android/WeexFrameworkWrapper/` 目录下 clone 对应的插件。 41 | 42 | ``` java 43 | git clone https://github.com/bmfe/WeexErosFramework.git "wxframework" 44 | git clone https://github.com/bmfe/eros-nexus.git "nexus" 45 | ``` 46 | > 首先clone 基础库,这里有2个。都clone 下来。 47 | 48 | * 打开Android目录`工程目录/platforms/android/WeexFrameworkWrapper/`,编辑`settings.gradle`,添加引入。 49 | 在`settings.gradle` 中 添加如下代码。 50 | 51 | ``` java 52 | include ':app',':sdk',':nexus', ':wxframework' 53 | 54 | // 基础库 55 | project(':wxframework').projectDir = new File(settingsDir,'/wxframework/eros-framework') 56 | project(':sdk').projectDir = new File(settingsDir,'/nexus/sdk') 57 | project(':nexus').projectDir = new File(settingsDir,'/nexus/nexus') 58 | 59 | ``` 60 | 61 | 基础库settings.gradle![](https://raw.githubusercontent.com/myliuyx/source/master/plugin_setting_gradle_2.png) 62 | 63 | 64 | 65 | * 打开Android目录`工程目录/platforms/android/WeexFrameworkWrapper/app`,编辑app目录下`build.gradle` 文件 `dependencies` 下添对应 插件引用。 66 | 67 | ``` ruby 68 | dependencies { 69 | .... 70 | compile project(':nexus') 71 | compile project(':wxframework') 72 | } 73 | ``` 74 | 基础库build.gradle![](https://raw.githubusercontent.com/myliuyx/source/master/plugin_app_gradle_2.png) 75 | 76 | * 添加完后,右上角 有一个 sync now。 点击 等待同步完成没有报错证明组件添加成功 77 | 78 | > 如果 Sync Now 出现错误 可尝试 clear 下项目 然后重新 同步下 79 | 80 | 81 | -------------------------------------------------------------------------------- /zh-cn/android_wx_apply.md: -------------------------------------------------------------------------------- 1 | # Android 微信相关使用 2 | 3 | **微信官网申请 相关Key 和签名 如下图** 4 | 5 | 图1![](https://raw.githubusercontent.com/myliuyx/source/master/bmweixin_1.jpg) 6 | 图2![](https://raw.githubusercontent.com/myliuyx/source/master/bmweixin_2.jpg) 7 | 图3![](https://raw.githubusercontent.com/myliuyx/source/master/bmweixin_3.jpg) 8 | 9 | > [微信官网](https://open.weixin.qq.com/) 自行参考图片 申请相关Key
您申请的应用签名请一定与您的包名一致,否则可能导致微信无法回调 10 | 11 | **Android 相关配置** 12 | 13 | 1.打开Android目录工程目录/platforms/android/WeexFrameworkWrapper/app,编辑app目录下build.gradle 文件 dependencies 下添加引用,代码如下: 14 | 15 | dependencies { 16 | ...... 17 | compile 'com.github.bmfe:eros-plugin-android-wxpay:1.1.0' // 具体版本参考最新 18 | } 19 | 20 | 2.打开Android目录工程目录/platforms/android/WeexFrameworkWrapper/app/src/main/java/com/benmu/wx/wxapi/下的WXEntryActivity.java和WXPayEntryActivity.java解开注释 21 | 22 | 3.更改Android目录工程目录/platforms/android/WeexFrameworkWrapper/app/src/main/AndroidManifest.xml 23 | 24 | ``` 25 | 28 | ``` 29 | 30 | 31 | 4.更改Android目录工程目录/platforms/android/WeexFrameworkWrapper/app/src/main/java/下com.benmu.wx为你的包名 右上角 有一个 sync now 点击根据提示修改报错的地方com.benmu.wx为你的包名 32 | 33 | > 如果您有修改 APPLICATION_ID 请一定需要修改您的包名与APPLICATION_ID 一致,否则可能导致无法调起微信,或者无法回调的问题。 34 | 35 | -------------------------------------------------------------------------------- /zh-cn/app_base_library.md: -------------------------------------------------------------------------------- 1 | * Eros工程基础库(包含) 2 | * 拓展的 weex 不具有的 `module`。 3 | * 拓展的 weex 不具有的 `component`。 4 | * 拓展的`简易更新逻辑`。 5 | * 内置了 `WeexSDK`。 6 | * ...持续优化中 7 | 8 | Eros 基础库是必须依赖的,初始化中的模板已经添加了基础库的依赖,用户需要关心的是升级基础库,通过插件的方式升级也很简单,只需要修改一下版本号即可,集成方式中有介绍; 9 | 10 | ## 集成方式 11 | 12 | **iOS 集成**
13 | * 打开iOS目录`工程目录/platforms/ios/WeexEros`,编辑Podfile文件,修改版本号(即 tag对应的版本号),库每次升级后都会有相关说明文档详情请看页面最下方的 Change Log,如需升级将 tag 修改为对应的版本即可; 14 | ```ruby 15 | def common 16 | ...忽略其他库的引用 17 | #集成 Eros iOS 基础库 18 | pod 'ErosPluginBaseLibrary', :git => 'https://github.com/bmfe/eros-plugin-ios-baseLibrary.git', :tag => '版本号' 19 | end 20 | target 'WeexEros' do 21 | common 22 | end 23 | ``` 24 | 25 | * 在终端中`cd`到此目录下执行 `pod update`,就会重新拉取最新版本的文件,等待命令执行完毕即可; 26 | 27 | **Android 集成** 28 | 29 | * 进入Android目录`工程目录/platforms/android/WeexFrameworkWrapper/` 目录下 clone 对应的插件。 30 | 31 | ``` java 32 | git clone https://github.com/bmfe/WeexErosFramework.git "wxframework" 33 | git clone https://github.com/bmfe/eros-nexus.git "nexus" 34 | ``` 35 | 36 | > 具体版本为Tag,如果您需要使用指定版本的话可以切换到指定的Tag. 37 | 38 | 39 | * 打开Android目录`工程目录/platforms/android/WeexFrameworkWrapper/`,编辑`settings.gradle`,添加引入。 40 | 在`settings.gradle` 中 添加如下代码。 41 | 42 | ``` java 43 | include ':app',':sdk',':nexus', ':wxframework' //(这里只需要添加 app 后面的 既 :,':sdk',':nexus', ':wxframework' ) 44 | 45 | // 基础库 46 | project(':wxframework').projectDir = new File(settingsDir,'/wxframework/eros-framework') 47 | project(':sdk').projectDir = new File(settingsDir,'/nexus/sdk') 48 | project(':nexus').projectDir = new File(settingsDir,'/nexus/nexus') 49 | 50 | ``` 51 | 52 | * 打开Android目录`工程目录/platforms/android/WeexFrameworkWrapper/app`,编辑app目录下`build.gradle` 文件 `dependencies` 下添对应 插件引用。 53 | 54 | ``` java 55 | dependencies { 56 | .... 57 | compile project(':nexus') 58 | compile project(':wxframework') 59 | } 60 | ``` 61 | 62 | * 具体Android 插件详细集成方式 您还可以参考[Android 插件依赖](/zh-cn/android_plugin_integration) 63 | 64 | ## Change Log 65 | **iOS 1.3.3** 2018.11.23
66 | * 优化App启动逻辑,避免热更新时重复初始化Weex环境; 67 | * 解决BMEvent `off` 方法不能取消监听事件的问题; 68 | 69 | **iOS 1.3.3** 2018.11.14
70 | * [update] 适配WeexSDK 0.19.0版本; 71 | * 升级部分依赖库; 72 | 73 | **iOS 1.3.2** 2018.10.11
74 | * [bugfix] 修复拓展的上拉加载更多loadMore事件与weex默认的loadmore事件冲突的问题;感谢 陈远•Frank,M、的贡献,[文档请戳](https://bmfe.github.io/eros-docs/#/zh-cn/base_extend?id=上拉加载更多) 75 | * [bugfix] 修复iPhoneX的判断方法;感谢 Shawn唐的贡献; 76 | 77 | **iOS 1.3.1** 2018.09.25
78 | * [教程] 升级 Xcode 10后会编译报错,请参考这篇文章来解决相关问题;[请戳这里](https://www.jianshu.com/p/6d94278d62b3) 79 | * [bugfix] 修复使用Xcode10开发并运行在iOS12系统上设置导航栏背景色无效的问题; 80 | * [bugfix] 解决使用`bmBundleUpdate`module进行热更新,当解压缩失败时没有回调callback的问题; 81 | * [optimize] 网络请求一些代码优化; 82 | * [update] 基础库包名已修改(ErosPluginBaseLibrary),详情请看上面的集成方式; 83 | 84 | **Android 1.1.0** 2018.09.07
85 | * [bugfix] input组件,type为number时不能输入小数点 86 | * [bugfix] 修复判断前后台方法错误问题. 87 | * [feature] 添加虚拟按键高度全局属性 virtualButtonsHeight 88 | 89 | **iOS 1.3.0** 2018.08.02
90 | * [bugfix-iOS]``标签加载`bmlocal`资源报错的问题; 91 | * [feature]`bmNavigator` module 添加隐藏状态栏功能;[文档请戳](https://bmfe.github.io/eros-docs/#/zh-cn/eros_sdk_module?id=bmnavigator) 92 | * [feature]`bmBundleUpdate` module 添加获取 JSVersion 方法;[文档请戳](https://bmfe.github.io/eros-docs/#/zh-cn/eros_sdk_module?id=bmbundleupdate) 93 | * [optimize]`bmchart`component 支持加载自定义 html 文件;[文档请戳](https://bmfe.github.io/eros-docs/#/zh-cn/eros_sdk_component?id=图表组件) 94 | 95 | **Android 1.0.9** 2018.08.02
96 | * [feature]`bmNavigator` module 添加隐藏状态栏功能;[文档请戳](https://bmfe.github.io/eros-docs/#/zh-cn/eros_sdk_module?id=bmnavigator) 97 | * [feature]`bmBundleUpdate` module 添加获取 JSVersion 方法;[文档请戳](https://bmfe.github.io/eros-docs/#/zh-cn/eros_sdk_module?id=bmbundleupdate) 98 | * [optimize]`bmchart`component 支持加载自定义 html 文件;[文档请戳](https://bmfe.github.io/eros-docs/#/zh-cn/eros_sdk_component?id=图表组件) 99 | 100 | **Android 1.0.8** 2018.07.26
101 | * [bugfix-Android]`tabbar` 多页面 `watchIndex` 只有一个生效问题 102 | * [bugfix-Android]`tabbar` 生命周期触发不正常问题。 103 | * [bugfix-Android] 解决issue[#248][#246] 104 | * [bugfix-Android] 解决部分页面内存泄漏问题 105 | * [bugfix-Android] 优化图片加载过多 的OOM 问题。 106 | * [feature]新增 `web` 标签支持本地html 107 | 108 | **iOS 1.2.9** 2018.07.26
109 | * [bugfix-iOS] `web`标签通过url传参参数丢失问题; 110 | * [bugfix-iOS] 微信分享插件、微信支付插件判断是否安装微信方法无效的问题(请升级最新版本); 111 | * [optimize-iOS] 优化 `bmChart` 加载本地js资源的方法; 112 | 113 | 114 | **Android 1.0.7** 2018.07.18
115 | * [bugfix]加载本地`html`参数丢失的问题; 116 | * [bugfix-Android]`input`标签动态切换`type = password`不生效; 117 | * [bugfix-Android]从后台进入app、tabbar上所有页面都会触发生命周期,应该只有当前显示的页面触发; 118 | * [bugfix-Android]`image`标签动态设置高度图片变形; 119 | * [bugfix-Android]加载本地`html`参数丢失的问题; 120 | * [feature]`bmTabbar` 新增监听切换页面方法、获取当前下标方法、及动态修改tabbar配置信息。[文档请戳](https://bmfe.github.io/eros-docs/#/zh-cn/eros_sdk_module?id=bmTabbar); 121 | * [feature-Android]更新`jsbundle`添加弹窗提示,行为保持跟iOS一致; 122 | * [feature]新增`bmBundleUpdate`module,开发者可以自定义更新`jsbundle`逻辑。[文档请戳](https://bmfe.github.io/eros-docs/#/zh-cn/eros_sdk_module?id=bmBundleUpdate); 123 | * [feature]`weex.config.eros`中添加`tabbarHeight`原生`TabBar`高度参数; 124 | * [feature]`bmImage`module 新增 `scanImage()`方法,识别图片二维码。[文档请戳](https://bmfe.github.io/eros-docs/#/zh-cn/eros_sdk_module?id=bmimage);感谢 [scholar-ink](https://github.com/scholar-ink)提供pr; 125 | * [feature]`bmRouter`module 添加 `claerHomePage()` 方法清除之前设置的首页; 126 | * [feature]新增友盟统计插件。[使用文档请戳] 127 | 128 | 129 | **iOS 1.2.8** 2018.07.18
130 | * [bugfix]加载本地`html`参数丢失的问题; 131 | * [bugfix]`mediator.js`中使用`bmRouter`跳转页面无效; 132 | * [feature]`bmTabbar` 新增监听切换页面方法、获取当前下标方法、及动态修改tabbar配置信息。[文档请戳](https://bmfe.github.io/eros-docs/#/zh-cn/eros_sdk_module?id=bmTabbar); 133 | * [feature]新增`bmBundleUpdate`module,开发者可以自定义更新`jsbundle`逻辑。[文档请戳](https://bmfe.github.io/eros-docs/#/zh-cn/eros_sdk_module?id=bmBundleUpdate); 134 | * [feature]`weex.config.eros`中添加`tabbarHeight`原生`TabBar`高度参数; 135 | * [feature]`bmImage`module 新增 `scanImage()`方法,识别图片二维码。[文档请戳](https://bmfe.github.io/eros-docs/#/zh-cn/eros_sdk_module?id=bmimage);感谢 [scholar-ink](https://github.com/scholar-ink)提供pr; 136 | * [feature]`bmRouter`module 添加 `claerHomePage()` 方法清除之前设置的首页; 137 | 138 | **iOS 1.2.7** 2018.07.04
139 | * [bugfix]修复debug按钮不兼容iPad8.0系统的问题;感谢 zhongdong提的pr; 140 | * [bugfix]修复原生tabbar设置上边栏颜色不生效的问题; 感谢 zhongdong提的pr; 141 | * [feature]标签支持 base64图片格式; 142 | * [feature]$router.toWebview 支持 bmlocal 机制加载jsbundle中 html 文件; 143 | * [feature] 标签及 $router.toWebview新增 web 与 weex 交互机制,详情请看[教程](/zh-cn/base_extend?id=web-%E4%B8%8E-weex-%E4%BA%A4%E4%BA%92); 144 | 145 | **Android 1.0.6** 2018.07.04
146 | * [bugfix]修复fetch传递参数不是字符串时导致的崩溃问题。 147 | * [bugfix]修复tabbar 切换不触发生命周期。 148 | * [feature]``标签支持 base64图片格式; 149 | * [feature]`$router.toWebview` 支持 `bmlocal` 机制加载`jsbundle`中 html 文件; 150 | * [feature] `` 标签及 `$router.toWebview`新增 web 也 weex 交互机制,详情请看[教程](/zh-cn/base_extend?id=web-%E4%B8%8E-weex-%E4%BA%A4%E4%BA%92); 151 | 152 | **iOS 1.2.6** 2018.06.21
153 | * [feature] 新增`bmTabbar`Module,支持设置tabbar数字角标及红点 [文档请戳](https://bmfe.github.io/eros-docs/#/zh-cn/eros_sdk_module?id=bmTabbar); 154 | * [bugfix]修复mediator.js中使用router跳转页面无效的问题; 155 | * [update]优化请求失败返回错误信息的逻辑; 156 | 157 | **Android 1.0.5** 2018.06.21
158 | * [feature] 新增`bmTabbar`Module,支持设置tabbar数字角标及红点 [文档请戳](https://bmfe.github.io/eros-docs/#/zh-cn/eros_sdk_module?id=bmTabbar); 159 | * [bugfix-Android]解决无法获取联系人问题; 160 | * [bugfix-Android]解决Tabbar 无法连接 weex-debugger 问题; 161 | * [bugfix-Android]解决导航栏 在4.4.4Androud 版本兼容性问题; 162 | * [bugfix-Android]解决拍照 allowCrop 不生效问题 ; 163 | 164 | **iOS 1.2.5** 2018.06.06
165 | 166 | * bmAxios 请求支持 application/x-www-form-urlencoded 表单格式; 167 | 168 | **Android 1.0.4** 2018.05.30
169 | 170 | * Axios支持表单提交格式; 171 | * 解决Tabbar 刷新崩溃问题; 172 | * 修复v-model问题; 173 | * 插件最新版本 174 | ``` 175 | implementation 'com.github.bmfe.eros-nexus:nexus:1.0.3' 176 | implementation 'com.github.bmfe:WeexErosFramework:1.0.4' 177 | ``` 178 | 179 | **Android 1.0.3** 2018.05.30
180 | 181 | * 拓展原生tabBar; 182 | * sdk恢复源码依赖; 183 | * 解决APP启动黑屏问题; 184 | 185 | **iOS 1.2.5** 2018.06.06
186 | 187 | * [feature] bmAxios 请求支持 application/x-www-form-urlencoded 表单格式; 188 | 189 | **iOS 1.2.4** 2018.05.30
190 | 191 | * 拓展原生tabBar; 192 | * router open 方法添加 backgroundColor 参数; 193 | * axios请求返回 response header; 194 | * bmToolModul 添加监听网络状态方法; 195 | * 修复点击推送消息唤起App崩溃的问题(请更新推送插件); 196 | 197 | **iOS 1.2.3** 2018.05.18
198 | 199 | * 修复模拟器首次运行一定几率crash的问题; 200 | * 修复热刷新后修改的页面MD5值校验失败的问题; 201 | 202 | **iOS 1.2.2** 2018.05.11
203 | 204 | * 修复热更新后,新增加的页面提示找不到的问题; 205 | * 优化webview加载时机,提升加载速度; 206 | * 修复日历单选模式重复点击一天样式显示的问题; -------------------------------------------------------------------------------- /zh-cn/base_config.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | > 整个项目中,只有两个配置文件,都放在了项目根目录的 `config` 文件夹下。 4 | 5 | ## eros.native.js -> 客户端 6 | 7 | 客户端需要读取的配置文件。 8 | 9 | > 注意: **`eros.native.js` 每次变动,都需要重新执行命令 `eros dev` 并重新运行你的 app 。** 10 | 11 | ```javascript 12 | { 13 | appName: "eros-demo", 14 | appBoard: "/config/index.js", 15 | androidIsListenHomeBack: "true", 16 | customBundleUpdate: 'true', 17 | version: { 18 | android: "1.0.0", 19 | iOS: "1.0.0" 20 | }, 21 | page: { 22 | homePage: "/pages/eros-demos/index.js", 23 | mediatorPage: "/mediator/index.js", 24 | navBarColor: "#3385ff", 25 | navItemColor:"#ffffff" 26 | }, 27 | url: { 28 | image: "https://app.weex-eros.com/xxx/xxx", 29 | bundleUpdate: "http://localhosts:3001/app/check" 30 | }, 31 | zipFolder: { 32 | server: "home/app", 33 | iOS: "/ios/WeexEros/WeexEros", 34 | android: "/android/WeexFrameworkWrapper/app/src/main/assets" 35 | }, 36 | getui: { 37 | enabled: "false", 38 | appId: "", 39 | appKey: "", 40 | appSecret: "" 41 | }, 42 | tabBar: { 43 | color: '#777777', 44 | selectedColor: '#00b4cb', 45 | backgroundColor: '#fafafa', 46 | borderColor: '#dfe1eb', 47 | list: [{ 48 | pagePath: '/pages/demo/router/tabbarItem1.js', 49 | text: '首页', 50 | icon: 'bmlocal://assets/TabBar_Item1@2x.png', 51 | selectedIcon: 'bmlocal://assets/TabBar_Item1_Selected@2x.png', 52 | navShow: 'true', 53 | navTitle: "首页" 54 | }, 55 | { 56 | pagePath: '/pages/demo/router/tabbarItem2.js', 57 | text: '联系人', 58 | icon: 'bmlocal://assets/TabBar_Item2@2x.png', 59 | selectedIcon: 'bmlocal://assets/TabBar_Item2_Selected@2x.png', 60 | navShow: 'true', 61 | navTitle: '联系人' 62 | }, 63 | { 64 | pagePath: '/pages/demo/router/tabbarItem3.js', 65 | text: '个人中心', 66 | icon: 'bmlocal://assets/TabBar_Item3@2x.png', 67 | selectedIcon: 'bmlocal://assets/TabBar_Item3_Selected@2x.png', 68 | navShow: 'true', 69 | navTitle: '我' 70 | } 71 | ] 72 | } 73 | } 74 | ``` 75 | ### 配置说明 76 | 77 | #### **`appName`**: 脚手架自动生成 app 名称。 78 | 79 | #### **`version`**: app 对应版本号,脚手架会自动初始化填写。 80 | * iOS: iOS 对应版本号。`(增量发布相关)` 81 | * android: andorid 对应版本号。`(增量发布相关)` 82 | 83 | #### **`androidIsListenHomeBack`**: 安卓平台 是否监听第一个页面的物理返回键。 84 | 85 | #### **`customBundleUpdate`**: 是否自定义更新jsbundle逻辑
86 | * 如果不想使用eros默认的更新逻辑请将此参数设置为 `true`,然后使用[bmBundleUpdate](https://bmfe.github.io/eros-docs/#/zh-cn/eros_sdk_module?id=bmBundleUpdate) module 自定义更新逻辑。 87 | 88 | #### **`page`** 页面配置相关: 89 | * homePage: 主页的 js 相对地址。 90 | * mediatorPage: 中介者页面的相对地址,中介者页面是为了让我们在多个页面(js)中间可以通过事件来通信。 91 | * navBarColor: 原生导航条的默认颜色。 92 | * navItemColor: 原生导航栏字体颜色。 93 | 94 | #### **`url`**: 路经相关: 95 | * jsServer: 本地 js 的服务路径。(默认脚手架自动填写) 96 | * image: 图片上传绝对路径。 97 | * bundleUpdate: 检测jsBundle更新接口。`(增量发布相关)` 98 | > 增量发布相关的配置可以结合着增量发布文章结合着一起看。 99 | 100 | #### **`zipFolder`** 内置包存放地址。 101 | * server: 自动生成差分包的目录,可将脚手架部署在服务器上,做增量发布。 102 | * iOS: ios内置包地址,如果需要变更项目目录,请对应修改,如果不需要,就不要修改。 103 | * android: android内置包地址,如果需要变更项目目录,请对应修改,如果不需要,就不要修改。 104 | 105 | #### **`getui`** 个推 (目前项目推送服务是基于个推实现的) 106 | * enabled: 是否启用个推服务。 107 | * appId、appKey、appSecret 在个推平台申请。 108 | 109 | #### **`tabBar`** 原生tabBar配置信息 110 | 111 | 如果你的 App 首页设计为多tab的样式可以将 page 中的 homePage 设置为 'tabBar',这样App首页会使用原生的tabBar,大大提升用户体验;同时可以通过 `bmTabbar` Module 设置红点或者数字角标,具体使用方法请参考 [bmTabbar](https://bmfe.github.io/eros-docs/#/zh-cn/eros_sdk_module?id=bmTabbar) 文档; 112 | 113 | * color:文字颜色; 114 | * selectedColor:文字选中后的颜色; 115 | * backgroundColor:tabBar背景颜色; 116 | * borderColor:tabBar上边栏颜色(tabBar最顶端1px的线条); 117 | * list:tabBarItem 配置信息 (2 <= item数量 <= 5); 118 | * pagePage:页面路径从 /page 开始填写; 119 | * text:标题; 120 | * icon:默认图片(注:只支持 png 图片,size 建议为50px左右,图片请命名为 xxx@2x.png); 121 | * selectedIcon:选择后图片(规则与icon一致); 122 | * navShow: 是否显示原生导航栏; 123 | * navTitle:导航栏标题; 124 | 125 | ## eros.dev.js -> 脚手架 126 | 127 | 脚手架会去读取此项配置来让开发者进行开发,调试,语法检测,mock,生成增量包和全量包等能力 128 | 129 | > 注意: **,`eros.dev.js` 每次变动,都需要重新启 eros dev 开发服务。**`(因为此项配置,是在脚手架启动的时才会去读取)`。 130 | 131 | ```javascript 132 | { 133 | exports: [ 134 | "js/service/bus.js", 135 | "js/pages/home/index.js", 136 | "js/pages/demo/index.js", 137 | "js/pages/home/tab1/index.js", 138 | "js/pages/home/tab2/index.js", 139 | "js/pages/home/tab2/components/router/index.js", 140 | "js/pages/home/tab3/index.js" 141 | ], 142 | alias: { 143 | "Components": "js/components", 144 | "Common": "js/common", 145 | "Config": "js/config", 146 | "Widget": "js/widget", 147 | "Pages": "js/pages", 148 | "Utils": "js/utils" 149 | }, 150 | eslint: false, 151 | server: { 152 | "path": "./", 153 | "port": 8889 154 | }, 155 | diff: { 156 | "pwd": "/Users/yangmingzhe/Work/opensource/eros-diff-folder", 157 | "proxy": "https://app.weex-eros.com/source" 158 | }, 159 | proxy: [{ 160 | "route": "/test", 161 | "target": "127.0.0.1:52077/test" 162 | }], 163 | mockServer: { 164 | "port": 52077, 165 | "mockDir": "./dist/mock" 166 | }, 167 | socketServer: { 168 | "switch": true, 169 | "port": 8890 170 | } 171 | } 172 | ``` 173 | 174 | ##### **`exports (重要)`** 175 | 暴露出你的页面对应的 js 地址,app中的每个页面本质上都对应一个 js,**所以你每次添加一个页面,都需要再次添加需要打包成 js bundle 的文件**。 176 | 177 | ##### **`alias`** 178 | 文件夹别名,方便快速访问。 179 | 180 | ```js 181 | import component from 'Components' //对应 js/components 182 | ``` 183 | ##### **`eslint`** 184 | **项目编译时是否需要进行 eslint 检查**。 185 | 186 | ##### **`server`** 187 | **脚手架运行 `eros dev` 服务的路径和端口,使用默认即可**。 188 | 189 | ##### **`proxy`** 190 | 代理相关,会把 `/test`路径对应的请求代理的到 `127.0.0.1:52077/test`,默认即可,无需修改。 191 | 192 | ##### **`mockServer`** 193 | 本地`mock`数据服务,因为`proxy`中已经把`/test`路径代理带`52077`端口,而我们在`52077`端口起了`mock`服务,所以能在本地`mock`数据。 194 | 195 | #### **`socketServer`** 196 | 热更新服务`开关`和`端口`,**若没有此项配置,热更新功能是无法使用的。** 197 | 198 | 199 | 200 | -------------------------------------------------------------------------------- /zh-cn/base_debug.md: -------------------------------------------------------------------------------- 1 | ## 实时预览 2 | eros 支持实时预览,即修改完代码可以立即查看效果 **<现已不在需要开启代理工具>** 3 | 4 | ### 1. 开启开发服务 5 | 6 | 在项目根目录中起开发服务: 7 | 8 | ``` 9 | $ eros dev 10 | ``` 11 | 12 | 脚手架会在项目根目录下生成 dist 文件,存放 JS Bundle。 13 | 14 | ### 2.关闭拦截器 15 | 16 | ![](image/debug.gif) 17 | 18 | 运行App,点击屏幕上的`debug`按钮-> `Setting` -> `Interceptor` 关闭拦截器,然后点击`Refresh`或者双击屏幕上`debug`按钮刷新页面,就会重新从服务器加载最新的 js 文件。 19 | 20 | > 拦截器的主要作用就是控制加载 js 文件的方式 21 | > - 打开状态:会从当前工程内置的资源中加载js资源文件;
22 | > - 关闭状态:就会从开发服务上加载js资源文件; 23 | 24 | **注**:使用`真机`调试需要将手机与起服务的pc连接到**同一个局域网内!!!** 25 | 26 | ## 热刷新 27 | eros 现已支持热刷新,即修改完代码保存(command + s)的时候,页面会自动刷新
28 | - 点击屏幕上的`debug`按钮-> `Setting` -> 打开`HotRefresh`开关,提示 “hot refresh connected.”,说明热刷新以开启 29 | 30 | **注**:热刷新只有在`eros dev`起服务,并且关闭拦截器的情况下才会生效 31 |
32 |
33 | ![](image/hotRefresh.gif) 34 | 35 | 36 | ## weex debug 真机断点调试 37 | 38 | 39 | 1. 重复上面真机调试的所有步骤。 40 | 2. 执行命令:`$ weex debug`,执行完毕后会自动唤起 Chrome 浏览器打开调试主页,并展示出了二维码。 41 | 3. 在App中,点击屏幕上的调试按钮在弹出框中点击`调试`,呼出扫一扫,对准二维码。 42 | 4. 选择 Debugger 即可断点调试(这时候页面是空白的,只能调试逻辑代码),点击 Inspector 即可查看页面结构。 43 | 44 | 45 | -------------------------------------------------------------------------------- /zh-cn/base_dependencies.md: -------------------------------------------------------------------------------- 1 | eros 项目中依赖只有2种,一种是 `JavaScript 依赖`,一种则是 `App SDK 相关依赖`。 2 | 3 | ## JavaScript 依赖 4 | `JavaScript 依赖`可以参考 package.json: 5 | 6 | ```js 7 | "dependencies": { 8 | "eros-widget": "^1.0.0", 9 | "weex-ui": "^0.3.13beta2" 10 | }, 11 | "devDependencies": { 12 | "babel-core": "~6.25.0", 13 | "babel-plugin-component": "^1.0.0", 14 | "babel-plugin-transform-runtime": "~6.23.0", 15 | "babel-preset-env": "~1.5.2", 16 | "babel-preset-stage-0": "^6.24.1", 17 | "babel-register": "^6.22.0", 18 | "eslint": "^4.17.0", 19 | "eslint-plugin-html": "^4.0.2", 20 | "eslint-plugin-vue": "^4.2.2" 21 | } 22 | ``` 23 | 24 | 在 `dependencies` 中我们配置了 `eros-widget` 和 `weex-ui`,`weex-ui` 我们知道是非常优秀的组件库,那么 `eros-widget` 是什么? 25 | 26 | > `eros-widget` 是对我们 eros-sdk 拓展出来的 module 的二次封装,使我们直接在 `Vue 实例`使用,也就是 this 上调用,eros-widget 不是必须的,但他可以帮我们间接的稳定 eros-sdk,所以建议还是使用 widget 拓展的方法。 27 | 28 | 具体可以参考 [eros-widget 文档部分](/zh-cn/eros_widget)。 29 | 30 | 由于 weex 和 eros 的开发差异性, weex-ui 中的 demo 是需要进行小部分修改即可运行的,基本都是路径的问题,开发时可以自己看脚手架输入日志来解决。 31 | 32 | #### 更新 `eros-widget`: 33 | 34 | ``` 35 | $ cnpm i eros-widget -S 36 | ``` 37 | 38 | ## App SDK 相关依赖 39 | * Eros工程基础库(必须依赖) 40 | * 拓展的 weex 不具有的 `module`。 41 | * 拓展的 weex 不具有的 `component`。 42 | * 拓展的`简易更新逻辑`。 43 | * 内置了 `WeexSDK`。 44 | * 其他插件库(选择依赖) 45 | * 微信分享; 46 | * 微信授权登录; 47 | * 微信支付; 48 | * 高德地图(封装了Weex-Amap); 49 | * 持续扩展中; 50 | 51 | #### **iOS 更新方法** 52 | 53 | > iOS 工程中将Eros基础库,及其他插件都封装成了pod库,采用版本管理,便于大家集成使用及版本更新;
54 | > (pod简介:全名[CocoaPods](https://cocoapods.org/),是iOS端的第三方库管理工具,类似 `npm`包管理工具) 55 | 56 | 下面以 Eros 基础库 BMBaseLibrary 为例说明一下升级依赖库的步骤: 57 | 58 | * 打开iOS目录`工程目录/platforms/ios/WeexEros`,编辑Podfile文件,修改版本号(即 tag对应的版本号),库每次升级后都会有相关说明文档,如需升级将 tag 修改为对应的版本即可; 59 | ```ruby 60 | def common 61 | ...忽略其他库的引用 62 | #Eros iOS 基础库 63 | pod 'ErosPluginBaseLibrary', :git => 'https://github.com/bmfe/eros-plugin-ios-baseLibrary.git', :tag => '版本号' 64 | end 65 | target 'WeexEros' do 66 | common 67 | end 68 | ``` 69 | 70 | * 在终端中`cd`到此目录下执行 `pod update`,就会重新拉取最新版本的文件,等待命令执行完毕即可; 71 | 72 | 73 | #### **Android 更新方法** 74 | 75 | * 打开Android目录`工程目录/platforms/android/WeexFrameworkWrapper/`,进入对应的库目录切换 `tag`,或者 直接 使用 `git pull` 更新代码即可。 76 | 77 | -------------------------------------------------------------------------------- /zh-cn/base_dev.md: -------------------------------------------------------------------------------- 1 | ### 建议 2 | 如果您之前的教程都跑过了,我们建议您跟着入门教程过一遍: 3 | - [入门教程](https://bmfe.github.io/eros-docs/#/zh-cn/tutorial_newcomer) 4 | 5 | 您也可以直接看对应的文档,节约时间: 6 | - [项目结构](https://bmfe.github.io/eros-docs/#/zh-cn/tutorial_newcomer?id=%E9%A1%B9%E7%9B%AE%E7%BB%93%E6%9E%84) 7 | - [Hello Eros](https://bmfe.github.io/eros-docs/#/zh-cn/tutorial_newcomer?id=hello-eros) 8 | 9 | -------------------------------------------------------------------------------- /zh-cn/base_env.md: -------------------------------------------------------------------------------- 1 | 2 | > 我们推荐全部都安装,**但标注必须的环境必须安装,不然无法开发与调试**。 3 | 4 | ## 基础环境`(必须)` 5 | darwin: 6 | * Node.js (>=9.x), npm version 4+ 7 | 8 | windows: 9 | * Git bash (并确定已经设置为`.sh脚本的默认执行程序`) 10 | 11 | ``` 12 | $ npm i eros-cli -g 13 | ``` 14 | 如果你在中国地区,我们还是推荐您使用 [cnpm](https://npm.taobao.org/) 安装或者直接修改为`淘宝源`。 15 | ``` 16 | $ cnpm i eros-cli -g 17 | ``` 18 | 19 | > 因为脚手架依赖了`node-sass`,安装失败有很多解决办法,可自行查找。 20 | 21 | ## darwin 开发 iOS`(必须)` 22 | > CocoaPods 使用过程中遇到问题及时 Google。 23 | 24 | ### 版本要求 25 | - ruby: `2.5.0` 以上 26 | - rubygems: <= `2.7.6` [降级参考](https://github.com/rubygems/rubygems/blob/master/UPGRADING.rdoc) 27 | - cocoapods: `1.4.0` (最好) 28 | 29 | 其他版本会有环境问题 30 | ### 安装 31 | * Xcode (appStore 下载) 32 | * CocoaPods(建议使用pod 1.4.0版本) 33 | * 升级 rubygem 环境:`$ sudo gem update --system` 34 | * 移除现有 rubygem 镜像:`$ gem sources --remove https://rubygems.org/` 35 | * 添加gem.ruby-china镜像:`$ gem source -a https://gems.ruby-china.com/` 36 | * 安装 CocoaPods:`$ sudo gem install cocoapods -v 1.4.0` 37 | * 如果以上命令报错则执行:`$ sudo gem install -n /usr/local/bin cocoapods -v 1.4.0` 38 | * 最后执行:`$ pod setup 过程比较漫长,请耐心等待执行完成` 39 | 40 | ## darwin/windows/linux 开发 Android`(必须)` 41 | ### 版本要求 42 | `AndroidStudio` 版本目前最好 43 | - `3.0.x` best (高版本不太稳定,会有很多问题) 44 | 45 | ### 安装 46 | 47 | JDK 是 JAVA 开发包,AndroidStudio 是 Android开发IDE,这两项不再做过多介绍。 48 | 49 | * 下载并安装 [JDK](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)。 50 | * 下载并安装 [Android Studio](https://developer.android.google.cn/studio/index.html)。 51 | 52 | 53 | > 如果您使用虚拟机进行跨平台开发,也需要配置好对应平台的所需环境。 54 | 55 | ## 模拟器安装`(必须)` 56 | * ios 开发中 xcode 已经自带了模拟器 57 | * android 开发者可以使用 android studio 再带模拟器,为了更好的效果,推荐下载 `Genymotion`模拟器 58 | 59 | >当然市面上的如 `夜神模拟器` 也是可以的,[调试教程](http://blog.csdn.net/qq_34653571/article/details/53007044?locationNum=14&fps=1),但是在 weex 0.17/0.18 中会出现 weex 实例化失败的问题,所以还是推荐 `Genymotion`。 60 | 61 | ## weex-toolkit`(可选)` 62 | `断点调试` app 的能力。 63 | ``` 64 | $ cnpm i -g weex-toolkit 65 | ``` 66 | > [weex-toolkit](https://github.com/weexteam/weex-toolkit) 是 weex 官方提供的一个脚手架命令行工具,你可以使用它进行 weex 项目的创建,调试以及打包等功能,我们这里只使用它的调试功能( `weex debug` ); 67 | 68 | ## 代理软件`(可选)` 69 | 帮助我们进行 app 请求抓包,分析问题。 70 | * darwin/linux 推荐下载 [Charles](http://xclient.info/s/charles.html?_=b75d1488fca52bf0f85a4d11ac1200e3)。 71 | 72 | 下完完成之后需要进行相关的配置: 73 | 74 | * [fidder 手机抓包](http://blog.csdn.net/gld824125233/article/details/52588275)(如果未生效可尝试重启fidder) 75 | * [charles 手机抓包](http://blog.csdn.net/suifeng3051/article/details/52087343) 76 | 77 | 至此,所有的相关的工具和软件都已下载完毕,下面我们开始创建一个 `eros-demo` 工程。 78 | -------------------------------------------------------------------------------- /zh-cn/base_extend.md: -------------------------------------------------------------------------------- 1 | # 全局属性 2 | 3 | 官方提供的`weex.config.env`属性上,包含了当前 Weex 页面的环境信息。 4 | 5 | 我们在其基础上,又扩展了新的属性,开发者可通过`weex.config.eros`查看所有属性。 6 | 7 | 新的属性包括: 8 | 9 | - `bmFontScale`:当前字体大小,值为 NORM(标准)、BIG(大号)、EXTRALARGE(特大) 10 | 11 | - `bmFontSize`:当前字体放大倍数,值为1、1.15、1.3等 12 | 13 | - `deviceId`:手机的唯一标示 14 | 15 | - `jsServer`:js所在地址的域名 16 | 17 | - `logLevel`:日志等级 18 | 19 | - `request`:请求后端接口的域名 20 | 21 | - `scale`:屏幕放大倍数 22 | 23 | - `statusBarHeight`:通知栏高度,可在适配 iPhoneX 时使用。在页面顶部添加一个`div`,高度与`statusBarHeight`一致,即可撑起顶部刘海区,还可修改`div`颜色,使其与页面主体部分一致 24 | - `navBarHeight `:原生导航栏高度,在自定义导航栏的时候高度取这值就可以 25 | - `touchBarHeight `:iPhoneX底部的touchBarHeight,可以通过此参数来判断是否是iPhoneX,来适配页面,当参数不等于0则表示是 iPhoneX设备; 26 | - `jsVersion `:当前内置包js版本号 27 | 28 | **注意事项:** 29 | 30 | 若用到``标签,``中的内容是找不到`weex.config.eros`的。 31 | 32 | 解决方法为在``之外的根页面上先获取`weex.config.eros`,通过事件传递或本地存储等方式,在``中使用。 33 | 34 | # 使用本地资源 35 | 36 | #### 加载图片资源 37 | 38 | 目前 Weex 的 `` 标签不支持加载本地图片资源,但是在实际开发中加载本地图片资源还是必须的功能,通过扩展 `` 组件使其支持此特性; 39 | 40 | **使用方法:** 41 | 首先需要将图片资源放到 assets 目录下,填写 src 时请以 bmlocal://assets/ 开头后面跟上图片的具体路径 。 42 | 43 | > 注意:图片不要使用中文命名 44 | 45 | **示例:** 46 | 47 | ```js 48 | 49 | ``` 50 | 51 | #### 加载 html 资源 52 | 53 | 目前 Weex 的 `` 标签不支持加载本地html资源,通过扩展 `` 组件使其支持此特性; 54 | 55 | **使用方法:** 56 | 首先需要将 html 放到 assets 目录下,填写 src 时请以 bmlocal://assets/ 开头后面跟上 html 的具体路径 。 57 | 58 | **示例:** 59 | 60 | ```js 61 | 62 | ``` 63 | 64 | #### 加载 iconfont 资源 65 | 66 | **使用方法:** 67 | 首先需要将图片资源放到 iconfont 目录下,填写 src 时请以 bmlocal://iconfont/ 开头后面跟上资源的具体路径。 68 | 69 | **示例:** 70 | 71 | ```js 72 | domModule.addRule('fontFace', { 73 | 'fontFamily': "iconfont2", 74 | 'src': "url('bmlocal://iconfont/font_1469606063_76593.ttf')" 75 | }); 76 | ``` 77 | 注意: 78 | > 线上资源直接按照官方,填写全路径即可。 79 | 80 | 81 | # 下拉刷新,上拉加载更多增强 82 | 83 | ## 下拉刷新 84 | 85 | Weex 自带的`` 组件使用起来不是很好用,效果也差强人意,综合考虑由 native 端来实现下拉刷新,方式是在 \`<scroller>、<list>\` 组件的基础上进行扩展,这样对于前端的改动最小,使用也非常简单,具体方式如下: 86 | 87 | #### 效果: 88 | 89 | ![](https://img.benmu-health.com/gitbook/show4.gif) 90 | 91 | #### 扩展特性 92 | 93 | 说明:在原有`scroller`、`list`组件基础上添加`showRefresh`属性来控制是否需要显示下拉刷新组件; 94 | 95 | **注:Android 只支持 list 组件** 96 | 97 | `showRefresh {bool}`:当值为\`true\`时 native 端自动为\`<scroller>\`或\`<list>\`添加下拉刷新组件(缺省此属性或者值为\`false\`时不会显示下拉刷新组件); 98 | 99 | #### 扩展事件 100 | 101 | `refresh`:当下拉并执行刷新操作时会触发这个事件,你可以在这个事件的处理函数中来执行刷新的操作,如重新请求数据; 102 | 103 | `refreshEnd`: 结束刷新动画,当刷新的操作完毕后需要调用此方法来结束刷新动画; 104 | 105 | ```js 106 | 115 | 134 | ``` 135 | 136 | ## 上拉加载更多 137 | 138 | > 使用方法和下拉刷新类似 139 | 140 | **注:Android 只支持 list 组件** 141 | 142 | `showLoadMore {bool}`:当值为\`true\`时 启用上拉加载更多组件(缺省此属性或者值为\`false\`时不启用); 143 | `loadingMoreTitle {string}`:上拉加载更多提示文字; 144 | 145 | #### 扩展事件 146 | 147 | `loadMore `:上拉加载更多时会触发这个事件,你可以在这个事件的处理函数中来执行操作,如请求数据; 148 | 149 | `loadMoreEnd`: 结束刷新动画,当加载更多操作完毕后需要调用此方法来结束动画; 150 | 151 | # input & textarea 光标 152 | 153 | > 修改光标颜色:`tint-color` 154 | 155 | 示例 156 | 157 | ```js 158 | 164 | ``` 165 | 166 | ![](https://img.benmu-health.com/gitbook/showInput.gif) 167 | 168 | 169 | # web 与 weex 交互 170 | > native 端在 webview 运行环境注入了一个 bmnative 对象,用于 js 与 Native 及 weex 进行交互,js 可以直接调用 bmnative 对象的方法,**支持 `` 标签 及 调用 `$router.toWebview` 打开的webview页面**; 171 | 172 | 1. closePage() 方法:关闭 web 页面返回上一个页面; 173 | ```js 174 | // 示例 175 | bmnative.closePage() 176 | ``` 177 | 178 | 2. fireEvent('event','info') 触发 weex 通过 [bmEvent](https://bmfe.github.io/eros-docs/#/zh-cn/eros_widget?id=event%EF%BC%88%E5%8F%91%E5%B8%83%E8%AE%A2%E9%98%85%EF%BC%89) 注册的事件,用于web与weex交互,'info'目前只支持字符串传递; 179 | ```js 180 | // 示例 181 | bmnative.fireEvent('event', 'info'); 182 | ``` 183 | 184 | 示例:[test.html](https://github.com/bmfe/eros/blob/master/src/assets/test.html) 185 | 186 | -------------------------------------------------------------------------------- /zh-cn/base_init.md: -------------------------------------------------------------------------------- 1 | > 执行此节之前,请确保`必须的环境`全都安装完成。 2 | 3 | ## 生成开发模板 4 | 通过脚手架自动生成 eros 目录,并进入生成的项目目录下: 5 | 6 | ```bash 7 | $ eros init 8 | ``` 9 | 依次填写: 10 | 11 | * 项目名称,默认 `eros-demo`。 12 | * 初始版本号,默认 `1.0.0`。 13 | * 模板类型,默认 `带有官方示例的丰富项目结构`,另外一个是`纯净开发版`。 14 | * 安卓包名,默认 `com.eros.demo`。 15 | 16 | **注意:**安卓手机上不能出现 2 个包名相同的应用,如果有,需要卸载,为了同时安装多个 `eros app `设置请勿重复。 17 | 18 | 脚手架会自动从 github 上拉取最新的 [eros-template 开发模板](https://github.com/bmfe/eros-template) 19 | 20 | 然后进入开发目录,执行 `cnpm i` 加载`node_modules` 21 | ``` 22 | $ cd eros-demo 23 | $ cnpm i 24 | $ eros dev 25 | ``` 26 | 27 | ## iOS 运行项目 28 | 确保您已经安装完成 [iOS 所需环境](/zh-cn/base_env)。 29 | 30 | `cd`到iOS工程目录`platforms/ios/WeexEros` 执行`pod update`命令来拉取iOS工程的依赖 31 | ``` 32 | $ pod update 33 | ``` 34 | 35 | 首次执行时间会稍长,命令执行完毕后找到当前目录下 `WeexEros.xcworkspace` 文件,双击即可唤起XCode打开 iOS 工程;
36 | 然后在XCode选择相应的模拟器(比如iPhone 8),点击`▶`按钮来运行项目。 37 | 38 | 39 | ## Android 导入工程 40 | 确保您已经安装完成 [Android 所需环境](/zh-cn/base_env)。 41 | 42 | * 命令行进入 `/platforms/android/WeexFrameworkWrapper/` 目录下 执行install.sh 文件。等待下载依赖库。 43 | 44 | 下载完成后手动导入: 45 | 46 | 1.点击 `AndroidStudio` 上方的` File--->New--->Import Project`。 47 | 48 | ![](https://img.benmu-health.com/gitbook/1505963461481.jpg) 49 | 2.找到 eros 在你本地的地址,选择 `platforms/android/WeexFrameworkWrapper`,点击`OK`。 50 | 51 | ![](https://img.benmu-health.com/gitbook/1505963624252.jpg) 52 | 3.待项目构建完成,点击 AndroidStudio 上方工具栏的 `Run`,即可运行项目。![](https://img.benmu-health.com/gitbook/1505963683163.jpg) 53 | 54 | > 第一次打开 AndroidStuido 时,由于本地环境未配置好,AndroidStuido 会提示错误,按照 IDE 提示,点击 `sync` 同步一下,大部分环境问题都可以解决。 55 | 56 | 注: 57 | * 可能您第一次构建的时间太长您也可以尝试[解决 Android Studio 第一次导入项目太慢](https://www.jianshu.com/p/ba8189146a6b)。实在不行就请耐心等待 Android Studio 自己构建完成吧 58 | * 如果您并不能成功的运行起来,您可以尝试去后面看看[常见问题](/zh-cn/QA)。 59 | 60 | 61 | 62 | ## 模板目录结构 63 | 64 | ```bash 65 | ├── config 66 | │   ├── eros.dev.js // 脚手架相关配置 67 | │   └── eros.native.js // 客户端相关配置 68 | ├── dist // 静态资源生成目录 69 | ├── node_modules // 依赖 70 | ├── scripts // 自动化脚本 71 | ├── platforms // 平台基础代码 72 | │   ├── android 73 | │   └── ios 74 | ├── src // 开发路径 75 | │ ├── assets // 静态资源路径 一般存放图片 76 | │ ├── iconfont // 静态资源路径 一般存放 iconfont 77 | │ ├── js // js bundle 开发路径 78 | │ └── mock // 本地请求 mock 地址 79 | ├── CHANGELOG.md // 版本升级变动 80 | ├── README.md // 首页 81 | └── package.json // npm 项目及依赖说明 82 | ``` 83 | 84 | 85 | 首次打开我们已经为您内置了由一些 `demo`,您可以看到相关的页面,下面在开发之前还需要进行一些相关的配置和调试的学习。 86 | 87 | 88 | > 如果在此节中出现任何问题均不能正常运行 demo,请在 [issue](https://github.com/bmfe/eros/issues?q=is%3Aissue+is%3Aclosed) 或者 [Q&A](https://bmfe.github.io/eros-docs/#/zh-cn/QA)中来寻到解决方法,如果还未找到,麻烦给我们[提issue](https://github.com/bmfe/eros/issues/new)。 89 | -------------------------------------------------------------------------------- /zh-cn/eros_intro.md: -------------------------------------------------------------------------------- 1 | ### 介绍 2 | eros 是基于 [weex](https://weex-project.io/cn/) 封装面向前端的 vue 写法的解决方案,由于 app 开发的特殊性,eros 则更偏重关心于整个 app 项目。 3 | 4 | 欢迎大家的 Pull requests 和 Issues,顺便留个 star 5 | 6 | #### 优势: 7 | * eros 对 weex 官方进行二次封装,能及时跟进 weex 的新特性, 8 | * eros-cli 支持生成开发模板,更新平台相关依赖,打包等,在熟悉了 eros 之后,对于中小型 app 应用能进行快速迭代。 9 | * eros-cli 和 eros-publish 的搭配使用,可以搭建简易增量发布。 10 | * 在开发中能更少的关注 weex 版本升级和本身的兼容性问题。**(综合在一个平台,当你遇到一个兼容性问题,当 eros 修复了,就是其他人少遇到一个问题,节约的是大家的时间)**。 11 | * 跟 weex 一样,给 vue 开发者另一个舞台。 12 | 13 | #### 不足: 14 | * weex debug 会出现些问题,eros 已经有方法解决,但不完美,还需要改进。 15 | * 由于人手不足,许多功能可能并不完善,修复可能需要大家的参与。 16 | * 由于 eros 本身是从公司业务冲抽离出来的,有些代码冗余和不规范。 17 | * 客户端依赖还未做动态加载,导致包体积会稍微大一些。 18 | 19 | eros 会尽全力弥补不足。 20 | 21 | #### 功能: 22 | 23 | * 客户端拓展了数十个 module 24 | * 提供 appboard 机制来减少包体积 25 | * 内置了一套完整的 widget ,可根据业务自行修改 26 | * eros-publish 提供了服务器端增量发布更新逻辑 27 | * eros init 生成开发模板 28 | * eros dev 启动服务进行实时开发效果查看和 debug 调试 29 | * eros install 更新开发平台所需 eros 依赖 30 | * eros pack 打对应平台内置包 31 | * eros build 支持生成全量包,增量包,并内置与更新服务器交互逻辑 32 | * eros update 同步更新模板内容 33 | * 支持 vue、sass、stylus、less、babel 34 | * 支持 weex 的 vue 入口式开发和 js 入口式开发 35 | * 等等... 36 | 37 | 38 | ### 工作原理 39 | 40 | ![工作原理](http://on-img.com/chart_image/59c5d743e4b0d34a18d69580.png) 41 | [大图地址](http://on-img.com/chart_image/59c5d743e4b0d34a18d69580.png) 42 | 43 | ### 前期准备 44 | 45 | 在开发之前可能需要学习并使用以下框架,而 eros 是基于他们来进行开发的。 46 | 47 | * [weex](http://weex-project.io/cn/) 48 | * [**vue**](https://cn.vuejs.org/index.html) 49 | 50 | 51 | ### 支持性 52 | 目前只支持 iOS 和 Android 的开发,暂不支持 web 。 53 | * Android 4.1 (API 16) 54 | * iOS 8.0+ 55 | * WebKit 534.30+ 56 | 57 | 58 | ##### 欢迎大家加入weex-eros微信开发群一起讨论,**在开发过程中如果遇到任何问题,我们将尽快为您答复。** 59 | 60 | ##### 由于当前群人数过多,目前只能通过邀请的方式进群请大家先添加小花同学的微信然后邀请大家进群。 61 | 62 | ![小花同学微信](https://gitee.com/uploads/images/2017/1026/154652_651ba169_1595985.jpeg) -------------------------------------------------------------------------------- /zh-cn/eros_plugin.md: -------------------------------------------------------------------------------- 1 | 在之前的工程模板中,Eros 集成了 微信分享、微信授权登录、微信支付、高德地图、个推推送等模块(Modules)及组件(Components),实现这些功能需要引用对应的第三方SDK,比如 Amap,WechatSDK 等,不管开发者是否使用到这些功能,最终打包的App都会集成这些三方库,导致安装包过大。为了解决这个问题,我们将工程框架进行了优化改进,将这些模块及组件从基础框架中解耦出来,并封装成了插件,可供大家根据需求自由选择集成,集成方式也非常简单,按照教程来没有原生开发基础的同学也可以轻松搞定; 2 | 3 | ## 插件开发 4 | > 有原生开发能力的同学,可以按照以下教程来贡献你的插件 5 | 6 | ## iOS 插件教程 7 | 8 | #### 一、开发你的功能 9 | > 这里其实没什么好说的,主要是你根据自己的想法做你自己的开发,不过可以稍微注意以下几点。 10 | 11 | 1. 最好将你的功能统一在一个目录下,这样之后方便podspec的代码引入和方便git管理。 12 | 13 | ![](https://ws1.sinaimg.cn/large/006tKfTcgy1frtgmmp3ntj307k0bcaa9.jpg) 14 | 15 | #### 二、自定义扩展 16 | 17 | 这里需要你参考一下[weex 官方文档扩展ios功能](http://weex.apache.org/cn/guide/extend-ios.html) 18 | 19 | 下面以扩展 Module 为例: 20 | 21 | 1. 新建一个类 `XXXModule` 继承 `NSObject`, 让该类遵循 `WXModuleProtocol` 的协议,比如下方实现的 `HMGesUnLockModule` 22 | 23 | ```js 24 | #import 25 | #import "WXModuleProtocol.h" 26 | @interface HMGesUnLockModule : NSObject 27 | 28 | @end 29 | ``` 30 | 31 | 2. 实现 Module 的方法,并通过 `WX_EXPORT_METHOD` 宏将方法暴露给 js 32 | 33 | ```js 34 | @synthesize weexInstance; 35 | // 将方法暴露出去 36 | WX_EXPORT_METHOD(@selector(addGesturePage:)) 37 | 38 | // 实现 Module 方法 39 | -(void)addGesturePage:(WXModuleCallback)callback{ 40 | [HMUnlockView showUnlockViewWithType:YWUnlockViewCreate callBack:^(BOOL result) { 41 | if(callback){ 42 | if(result){ 43 | callback(@"success"); 44 | }else{ 45 | callback(@"fail"); 46 | } 47 | } 48 | }]; 49 | } 50 | ``` 51 | 52 | 3. 注册module。 53 | 54 | >最关键的一步到了!!!!这里和官方文档不太一样。 55 | 56 | 官方文档教我们的注册的方法是 调用 `WXSDDKEngine` 的 `registerModule:withClass:`方法 57 | 58 | ```js 59 | [WXSDKEngine registerModule:@"hmGesUnlock" withClass:[HMGesUnLockModule class]]; 60 | ``` 61 | 62 | 插件化我们希望的是用户直接通过 pod 引用后不需要添加任何原生代码,js 端即可正常使用,所以我们希望 Module 或者 Component 的注册方法也可以动态完成,刚好 Weex 有对应的加载器机制,那就是`WeexPluginLoader`,可以通过 `WX_PlUGIN_EXPORT_MODULE`、`WX_PlUGIN_EXPORT_COMPONENT`两个宏来注册你扩展的 Module 或 Component,比如HMGesUnLockModule.m 文件中 63 | 64 | ```js 65 | #import 66 | ... 67 | // 第一个参数为暴露给 js 端 Module 的名字, 68 | // 第二个参数为你 Module 的类名 69 | WX_PlUGIN_EXPORT_MODULE(hmGesUnlock, HMGesUnLockModule) 70 | ``` 71 | 72 | 这样,你就在pod引入后自动注册,而不需要特地在你的代码中的某个地方去执行 `registerModule:withClass:` 了。 73 | 74 | #### 三、上传git库 75 | 到这里,你的功能应该已经在你的demo中没有任何问题了吧?那我们可以开始插件化的第一步了。 76 | 77 | 1. 在你自己的github上面创建一个仓库。 78 | 2. 在你的项目中一连串init add commit push 。。。。(由于这里是插件教学贴,不是git使用教学贴,相关git使用方法请自行 google) 79 | 3. 好了,到这里,你已经把你的代码放到你的git上面了,已经可以找人给你刷星星了。。。。虽然人家还用不了。。。。。。 80 | 81 | 82 | #### 四、封装 pod 库 83 | 84 | 1. 首先,先将你刚刚创建的仓库clone到你的本地 85 | 2. 创建podspec文件,在这个git目录下执行 86 | 87 | ```js 88 | pod spec create 89 | 90 | #e.g. 91 | pod spec create WeexHMGesUnlock 92 | ``` 93 | 94 | 3. 这个时候,你在你的目录下,就可以看到 95 | ``` 96 | WeexHMGesUnlock.podspec 97 | ``` 98 | 文件了。 99 | 100 | 4. 编辑 `xxx.podspec` 文件 101 | 102 | ```ruby 103 | Pod::Spec.new do |s| 104 | 105 | s.name = "PodTestLibrary" #插件名称 106 | s.version = "0.0.1" #版本号 107 | s.summary = "Just Testing." #简短介绍,下面是详细介绍 108 | s.description = <<-DESC 109 | Testing Private Podspec. 110 | * Markdown format. 111 | * Don't worry about the indent, we strip it! 112 | DESC 113 | 114 | s.homepage = "github地址" #主页,这里要填写可以访问到的地址,不然验证不通过 115 | s.license = 'MIT' #开源协议 116 | s.author = { "你的名字" => "邮箱地址" } #作者信息 117 | s.source = { :git => "git Clone 地址", :tag => s.version.to_s } #项目地址,这里不支持ssh的地址,验证不通过,只支持HTTP和HTTPS,最好使用HTTPS 118 | s.platform = :ios, '8.0' #支持的平台及版本 119 | s.requires_arc = true #是否使用ARC,如果指定具体文件,则具体的问题使用ARC 120 | 121 | s.source_files = 'Pod/Classes/**/*' #代码源文件地址,**/*表示Classes目录及其子目录下所有文件,如果有多个目录下则用逗号分开,如果需要在项目中分组显示,这里也要做相应的设置 122 | 123 | s.resource_bundles = { 124 | 'PodTestLibrary' => ['Pod/Assets/*.png'] 125 | } #资源文件地址 126 | 127 | s.public_header_files = 'Pod/Classes/**/*.h' #公开头文件地址 128 | s.frameworks = 'UIKit' #所需的framework,多个用逗号隔开 129 | s.dependency 'AFNetworking', '~> 2.3' #依赖关系,该项目所依赖的其他库,如果有多个需要填写多个s.dependency 130 | 131 | end 132 | 133 | ``` 134 | 再详细的配置,可以自行google一下,欢迎补充啊。比如还有一些s.dependency 之类的,如果有需要可以自行配置。[可参考](https://www.jianshu.com/p/f841e248bc4f) 135 | 136 | 5. 把这个文件提交到你的github上去; 137 | 6. 在你的 master 上面打个tag吧。。。。这个动作很重要!!!这个动作很重要!!!这个动作很重要!!!
138 | **注意: tag 对应的就是库的版本号,每次修改代码,都需要更新库的版本号及重新打 tag;** 139 | 140 | #### 五、本地引入 141 | 142 | 1. 在你需要引入的项目中把你的项目`clone`到你`podfile`所在的目录。 143 | 2. 然后在你的`Podfile`中加入 144 | 145 | ```ruby 146 | pod 'WeexHMGesUnlock', :path=>'./WeexPlugin-HMGesUnlock/' 147 | ``` 148 | 149 | 3. 执行 150 | 151 | ``` 152 | pod update 153 | ``` 154 | 155 | 156 | #### 六、插件引入 157 | 158 | 159 | 1. 在你的`Podfile`中加入 160 | 161 | ```ruby 162 | # tag可以不写,默认依赖 master 分支代码 163 | pod 'WeexHMGesUnlock', :git => 'https://github.com/shawn-tangsc/WeexPlugin-HMGesUnlock.git', :tag => '1.0.0' 164 | ``` 165 | 166 | 167 | 2. 执行 pod update 168 | 169 | ``` 170 | pod update 171 | ``` 172 | 173 | #### 七、书写文档 174 | 175 | 插件开发完毕后,文档至关重要,在文档中请详细说明功能及使用方法; 176 | 177 | ## Android 插件教程 178 | 179 | [android-eros-plugin-simple](https://github.com/bmfe/android-eros-plugin-simple) 180 | 具体 插件开发可参考此demo -------------------------------------------------------------------------------- /zh-cn/eros_sdk_component.md: -------------------------------------------------------------------------------- 1 | Eros 扩展的 Components 2 | 3 | ## 图表组件 4 | > 基于 echart 实现的图标组件,支持 echart 的所有图表类型; 5 | 6 | ### 效果展示 7 | 8 | ![](https://img.benmu-health.com/gitbook/Echart.gif) 9 | 10 | ### 属性: 11 | 12 | * options:图表数据,请按照 echart 官方语法书写。 13 | * src:(可选)通过此参数可以指定 html 的地址。 14 | 15 | ### 事件: 16 | 17 | * finish: 图表渲染完毕事件 18 | 19 | 注:`options` 数据需要调用 `$format(options)`进行格式化一下,[$format(options)](https://bmfe.github.io/eros-docs/#/zh-cn/eros_widget?id=format-echart-%E7%9B%B8%E5%85%B3)说明文档; 20 | 21 | ### 🌰 22 | 23 | ```js 24 | 29 | 30 | 82 | ``` 83 | 84 | ### echart 增强 85 | 86 | eros 默认可以显示 echarts 绝大多数数据图表,如果当前功能不能满足你的需求,我们提供了增强机制,来方便大家进行扩展能力,比如显示热力图等,在这之前让我们先了解一下 eros 是如何实现 echart 的; 87 | 88 | #### 实现原理 89 | 90 | 大家都知道 ECharts 是JavaScript实现的库,运行在 web 端,所以 eros 扩展的`bmchart`组件原生端就是通过`webView`实现的,`bmchart`有一个`options`属性提供给js,用于传入 echarts 所需的数据,我们在 app 中内置了一个`bm-chart.html`文件及`echarts.min.js`文件,初始化`webView`后会加载这个 html 文件,你可以在工程中查看一下这个 html 的源码,实现非常简单,引入了一下 echarts.min.js 文件,然后实现了一个 `setOption` 方法,用于与原生交互接收图表数据,同时初始化 echarts 实例,并调用 echarts 实例的 `setOption(options)`方法来显示图表数据; 91 | 92 | #### 自定义实现 93 | 94 | 你可以通过 `bmchart` 的 `src` 属性来指定访问你的 html 文件的地址,支持 `bmlocal` 机制从 jsbundle 中加载资源; 95 | 96 | 1.在工程的 assets 文件夹中放入 html 文件及所需的 js 资源(支持通过相对路径加载本地js资源); 97 | 98 | ![chart1](./image/chart1.png) 99 | 100 | 2.编辑 html 文件引入新的 js 资源,比如实现热力图所需的 `bmap.min.js` 101 | 102 | ```html 103 | 104 | 105 | 106 | ... 107 | ... 108 | 109 | 110 | 111 | 112 | 113 | 114 | ECharts 115 | 116 | ... 117 | ... 118 | 119 | 120 | ``` 121 | 122 | 3.`src` 属性填写本地`html` 路径,传入图标数据 123 | 124 | ```js 125 | 126 | ``` 127 | 128 | ```js 129 | bmapInfo:{ 130 | animation: false, 131 | bmap: { 132 | center: [119.653564453125, 30.41142463684082], 133 | zoom: 14, 134 | roam: true 135 | }, 136 | visualMap: { 137 | show: false, 138 | top: 'top', 139 | min: 0, 140 | max: 5, 141 | seriesIndex: 0, 142 | calculable: true, 143 | inRange: { 144 | color: ['blue', 'blue', 'green', 'yellow', 'red'] 145 | } 146 | }, 147 | series: [{ 148 | type: 'heatmap', 149 | coordinateSystem: 'bmap', 150 | data: [[119.653564453125, 30.41142463684082,23]], 151 | pointSize: 5, 152 | blurSize: 6 153 | }] 154 | } 155 | ``` 156 | 157 | 效果图 158 | 159 | 160 | 161 | 162 | ## 弹窗组件 163 | 164 | > `` 和 `` 是一套组合组件,`` 对应背景遮罩,`` 对应弹出的视图,自带动画,不需要 js 处理。 165 | 注意: 166 | `` 应作为 `` 的子组件; 167 | 168 | 169 | ### bmmask 170 | 171 | 注:只支持子组件 `bmpop` 172 | 173 | ### 属性: 174 | - duration {number} : 动画时间 单位毫秒,可选 默认300毫秒; 175 | - animation {string}: 可选,默认没动画; 动画类型 1.transition(位移效果) 2. scale(缩放效果); 176 | - position {string}: 可选,默认在底部;1.top(从页面上方开始动画)2.center(页面中间开始动画,center的时候只能是缩放效果)3.bottom(从页面底部开始动画); 177 | - disableMaskEvent {bool}: 取消背景遮罩的点击事件 可选;(当值为 true 时,背景遮罩不响应点击事件,默认响应 可以不传); 178 | 179 | ### 样式 180 | 181 | - 通用样式:支持所有通用样式 182 | 183 | ### 事件 184 | 185 | - show :显示组件·淡入效果(组件创建完默认是隐藏的); 186 | - hide :隐藏组件·淡出效果; 187 | 188 | 注:show 和 hide 都会带动 组件一起显示或隐藏 189 | 190 | #### bmpop 191 | 192 | ### 子组件 193 | 194 | - 所有组件 195 | 196 | ### 特性 197 | 198 | - 无 199 | 200 | ### 样式 201 | 202 | - 通用样式:支持所有通用样式 203 | 204 | ### 事件 205 | 206 | 无 207 | 208 | ### 示例 209 | 210 | ```javascript 211 | 212 | 213 | 214 | 215 | 216 | 217 | .mask { 218 | position: absolute; 219 | top: 0; 220 | left: 0; 221 | right: 0; 222 | bottom: 0; 223 | background-color: rgba(0, 0, 0, .4); 224 | } 225 | 226 | .modal-top { 227 | align-items: flex-start; 228 | justify-content: flex-start; 229 | } 230 | ``` 231 | 232 | ## 原生日期选择 233 | 234 | ### 效果 235 | 236 | ![](https://img.benmu-health.com/gitbook/test.gif) 237 | 238 | ### 参数 239 | 240 | > * dataFormat:日期格式 非必传,默认 yyyy-MM–dd 241 | > * minimumDate: 最小日期 \(必传参数\) 格式遵守 dataFormat 242 | > * maximumDate: 最大日期 \(必传参数\) 243 | > * selectType: 可选值 ‘single’、‘range’,分别对应 单选、区间; 非必填 默认为‘single’ 244 | > * startDate:默认选择的日期 非必传 245 | > * endDate:默认选择的截止日期(selectType为range时生效)非必传 246 | > * showPlaceholder: 是否显示非当前月的日期占位符 默认不显示; 247 | 248 | ### 样式 249 | 250 | > month-color: 月份颜色 251 | > 252 | > week-color: 周几的颜色 253 | > 254 | > week-bg-color: 周几的背景颜色 255 | > 256 | > weekday-color: 平日的颜色 257 | > 258 | > weekend-color: 周末的颜色 259 | > 260 | > placeholder-color: 非本月日期颜色 261 | > 262 | > select-color: 选中的颜色 263 | 264 | ### 方法 265 | 266 | > * goPrve\(\) 上一月 267 | > * goNext\(\) 下一月 268 | 269 | ### 事件 270 | 271 | > * finish: 当选择完成会触发这个方法,将结果返回 {‘startDate’:'2017-08-08','endDate': '2017-08-09'}; 272 | 273 | ### 示例 274 | 275 | ```js 276 | 284 | 300 | 301 | 306 | ``` 307 | 308 | ## 富文本组件 309 | 310 | 1.文本通过 `value`属性设置; 311 | 312 | 2.`bmspan`可以不写字体样式,默认会继承‘bmrichtext’的字体样式; 313 | 314 | 3.`bmrichtext` 与 `bmspan` 标签本身支持 `v-if`条件,但是不支持 `v-for`表达式,使用 `v-for`时可以在包一层`div`来实现; 315 | 316 | 317 | 318 | ```js 319 | 举个例子: 320 |
321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 |
329 | 330 |
331 |
332 |
333 | ``` 334 | 335 | ![](https://img.benmu-health.com/gitbook/import.png) 336 | 337 | 338 | 339 | 340 | 341 | -------------------------------------------------------------------------------- /zh-cn/image/addAccounts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/addAccounts.png -------------------------------------------------------------------------------- /zh-cn/image/addGetuiJson.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/addGetuiJson.jpeg -------------------------------------------------------------------------------- /zh-cn/image/advanced_bindingx.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/advanced_bindingx.gif -------------------------------------------------------------------------------- /zh-cn/image/androidDemo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/androidDemo.gif -------------------------------------------------------------------------------- /zh-cn/image/bmap.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/bmap.jpg -------------------------------------------------------------------------------- /zh-cn/image/bmap1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/bmap1.png -------------------------------------------------------------------------------- /zh-cn/image/chart1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/chart1.png -------------------------------------------------------------------------------- /zh-cn/image/debug.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/debug.gif -------------------------------------------------------------------------------- /zh-cn/image/debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/debug.png -------------------------------------------------------------------------------- /zh-cn/image/del_link1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/del_link1.png -------------------------------------------------------------------------------- /zh-cn/image/del_link2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/del_link2.png -------------------------------------------------------------------------------- /zh-cn/image/eros-qq-qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/eros-qq-qrcode.png -------------------------------------------------------------------------------- /zh-cn/image/eros.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/eros.ico -------------------------------------------------------------------------------- /zh-cn/image/gesunlock.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/gesunlock.gif -------------------------------------------------------------------------------- /zh-cn/image/getui.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/getui.jpg -------------------------------------------------------------------------------- /zh-cn/image/hotRefresh.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/hotRefresh.gif -------------------------------------------------------------------------------- /zh-cn/image/idfaSet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/idfaSet.png -------------------------------------------------------------------------------- /zh-cn/image/iosInstallError.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/iosInstallError.jpeg -------------------------------------------------------------------------------- /zh-cn/image/iosqr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/iosqr.png -------------------------------------------------------------------------------- /zh-cn/image/modify_gradle_verison.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/modify_gradle_verison.jpg -------------------------------------------------------------------------------- /zh-cn/image/qbmDatePicker.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/qbmDatePicker.gif -------------------------------------------------------------------------------- /zh-cn/image/removeAtsdk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/removeAtsdk.png -------------------------------------------------------------------------------- /zh-cn/image/right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/right.png -------------------------------------------------------------------------------- /zh-cn/image/rightItem@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/rightItem@2x.png -------------------------------------------------------------------------------- /zh-cn/image/shang.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/shang.jpeg -------------------------------------------------------------------------------- /zh-cn/image/show.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/show.gif -------------------------------------------------------------------------------- /zh-cn/image/xiaohua.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmfe/eros-docs/026b6a0471565142f4f863aeeb2c4fd36a14a6f4/zh-cn/image/xiaohua.png -------------------------------------------------------------------------------- /zh-cn/ios_config.md: -------------------------------------------------------------------------------- 1 | # App名称、版本号设置 2 | 3 | 1. 打开 iOS 工程,选择工程目录 4 | 2. 点击WeexEros 工程文件 5 | 3. 在 TARGERS 中选择 WeeEros 6 | 4. 选择 Genneral 设置项 7 | 8 | 如下图![](https://img.benmu-health.com/gitbook/appname.png) 9 | 10 | #### 说明 11 | 12 | Display Name:App 安装到手机上显示的名称; 13 | 14 | Bundle Identifier:App 唯一标示(开发者后台配置的AppID) 15 | 16 | Version:版本号 17 | 18 | Build:Build 号 19 | 20 | 21 | ### 如何修改iOS工程名 22 | 23 | 我们刚刚使用eros init出来的项目,工程默认是这样的 24 | ![](https://ws4.sinaimg.cn/large/006tKfTcgy1fs607kf4sgj30f20esmxe.jpg) 25 | 26 | 如果你是“强迫症患者”,你一定会说想把工程名字改成你想要的名字。就像这样: 27 | ![](https://ws3.sinaimg.cn/large/006tKfTcgy1fs609atdlvj308e0e9weo.jpg) 28 | 29 | 那这个时候,就需要执行下面步骤就可以了 30 | 31 | * 首先,用xcode打开项目,在工程目录中,长按项目名,修改项目名 32 | 33 | * 然后,xcode会跳出一个一个谈话框,这里他会告诉你有一些文件需要跟着一起修改,你只要选择rename就可以了。 34 | 35 | * 之后,你可以修改项目下的weexEros 文件夹,修改成和你项目名一样,同时也可以修改.elements文件名。 36 | 37 | * 这个时候要注意了!!!请到build setting 里,搜索WeexEros ,然后将对应的地方全部修改成你改动过后的名字。 38 | 39 | * 现在,你可以关掉xcode,然后进入ios的工程目录,修改podfile的target 40 | 41 | ``` 42 | ... 43 | target '' do 44 | common 45 | end 46 | ``` 47 | * 再去修改install.sh 中对应的命令: 48 | 49 | ``` 50 | ... 51 | open .xcworkspace 52 | ``` 53 | 54 | * 最后,回到你的eros项目内,执行。 55 | 56 | ``` 57 | eros install --ios 58 | ``` 59 | 60 | * 至此,你已经成功的修改了eros 默认的项目名称,并且打开了你自己的ios project,但是,启动的时候会报错,这个时候:**你就需要进入的ios项目中》打开你的general 》找到Linked Frameworks and Libraries 》 删除libPods-WeesErosApp.a (你也可以对应的删掉Frameworks 中的引入文件)** 61 | 62 | * ***注意!!!*** 这里需要你再最后修改一个地方,那就是eros.native.js中的zipFolder.iOS否则npm run pack 的时候会报错。 63 | 64 | ``` 65 | 'zipFolder': { 66 | 'iOS': '/ios/WeexEros/', 67 | ... 68 | }, 69 | ``` 70 | 71 | 72 | * 启动,这个时候就可以正常启动成功了。 73 | -------------------------------------------------------------------------------- /zh-cn/ios_image.md: -------------------------------------------------------------------------------- 1 | # 图片配置 2 | 3 | 此部分教程主要说明如何修改 App logo、启动图(Launchimage)、以及工程中一些用到的默认图片; 4 | 5 | ### 首先打开 iOS 工程 6 | 7 | cd 到 ios/WeexEros 目录下,执行命令:`$ open WeexEros.xcworkspace open` 然后会调用 Xcode 打开工程,或者到目录下直接双击 `WeexEros.xcworkspace` 8 | 9 | #### 找到 Assets.xcassets 文件 10 | 11 | 工程配置的图片都在 Assets.xcassets 中,打开后是下面这个样子 12 | 13 | ![](https://img.benmu-health.com/gitbook/weexErosimg.png) 14 | 15 | #### 说明 16 | 17 | > 1x 图片是给非Retina屏用的,iPhone 4 之前的机型,iPhone3GS 这部分机型直接无视,所以不需要设置图片 18 | > 19 | > 2x 图片是给 Retina 屏用的,iPhone 4(含)之后的机型 20 | > 21 | > 3x 图是专为 5.5 寸机型提供的,但不是必须的,如果 3x图没有系统会使用 2x 的图片 22 | 23 | ``` 24 | |- AppIcon // logo 图片 25 | |- LaunchImage // 启动页图片 26 | |- Navbar 27 | |- NavBar_BackIcon // 导航栏默认的返回按钮图片 28 | |- NavBar_BackItemIcon // 自定义的返回按钮图片 29 | |- Other 30 | |- image_placeholder // 标签 站位图片,图片加载失败会显示这个站位图 31 | |- pullLoadding // 下拉刷新动画 32 | |- Scan 33 | |- Scan_line // 扫一扫的线 34 | |- Scan_pick_bg // 扫一扫中的框 35 | ``` 36 | 37 | #### 替换方法 38 | 39 | > 以上图片都可以替换为自己的,考虑到一些开发人员没有 iOS 开发经验,以免出错,请按以下教程来操作 40 | 41 | 以 AppIcon为例 42 | 43 | ![](https://img.benmu-health.com/gitbook/appicon.png) 44 | 45 | 选中 AppIcon 右键 -> Show in Finder 46 | 47 | ![](https://img.benmu-health.com/gitbook/appicon1.png) 48 | 49 | 打开 AppIcon.appiconset 文件夹 50 | 51 | ![](https://img.benmu-health.com/gitbook/AppIcon2.png) 52 | 53 | 注意图片尺寸,还有命名规范要与之前的保持一致,然后将新的图片直接覆盖就可以了; 54 | 55 | 其他图片的替换方式一样; 56 | 57 | -------------------------------------------------------------------------------- /zh-cn/ios_project.md: -------------------------------------------------------------------------------- 1 | ## 工程简介 2 | 3 | 打开 iOS 工程首先看一下主工程目录,你会发现项目非常的清爽,只包含几个必要的文件,连一个 `UIViewController`都不存在,我们将代码都封装到 Pods 库 BMBaseLibrary 里面,通过 Pods 的方式加载进来。
4 | 在工程里还有三个文件需要注意: 5 | 6 | ```js 7 | eros.native.json // 配置文件: App 启动的时候会从加载里面的配置信息 8 | bundle.zip // js bundle,iconfont 资源包:App 首次启动会将相关资源解压到沙盒目录中,之后会从该目录加载 js 资源文件; 9 | bundle.config // js bundle 版本信息;描述当前 js 的版本,作为版本管理文件; 10 | 11 | 这三个文件不需要我们手动管理,在前文 内置打包 一章中有介绍,打包后会自动替换这三个文件,**切记不可删除与修改**; 12 | ``` 13 | 接下来看一下工程是如何引用 WeexSDK、及 BMBaseLibrary Pods 库的; 14 | 15 | ## Podfile 16 | 17 | 看一下 Podfile 就一目了然了 18 | 19 | ```js 20 | // 引入的其他pods库这里就不列举了,请看源文件 21 | #WeexSDK 22 | pod 'WeexSDK', :git => 'https://github.com/bmfe/WeexiOSSDK.git', :tag => '0.18' 23 | 24 | #Eros iOS 基础库 25 | pod 'ErosPluginBaseLibrary', :git => 'https://github.com/bmfe/eros-plugin-ios-baseLibrary.git', :tag => '1.3.1' 26 | ``` 27 | 28 | 运行 `pod update` 就会将这个两个库了加载到工程中了; 29 | 30 | ## Module 扩展 31 | 32 | `Module`是 js 与 native 交互的机制,比如像页面跳转、网络请求等一些操作,需要 native 通过扩展 `Module` 的方式提供接口供 js 调用,自定义 module 的步骤: 33 | 34 | > 1. 自定义的module类 必须实现 WXModuleProtocol 35 | 2. 必须添加宏`WX_EXPORT_METHOD`, 它可以被weex识别,它的参数是 JavaScript调用 module指定方法的参数 36 | 3. 添加@synthesized weexInstance,每个moudle对象被绑定到一个指定的实例上 37 | 4. Module 方法会在UI线程中被调用,所以不要做太多耗时的任务在这里,如果要在其他线程执行整个module 方法,需要实现WXModuleProtocol中- (NSThread *)targetExecuteThread的方法,这样,分发到这个module的任务会在指定的线程中运行 38 | 5. Weex 的参数可以是 String 或者Map 39 | 6. Module 支持返回值给 JavaScript中的回调,回调的类型是WXModuleCallback,回调的参数可以是String或者Map 40 | 41 | 下面以网络请求 Module `bmAxios` 为例(其他 module 的实现请直接查看源码): 42 | 43 | > 可能 native 端的同学会有疑问,为啥名字是 `Axios`,因为前端有个著名的网络请求库就叫'Axios',类似于 iOS 端的 `AFNetwork`,所以为了方便前端同学识别 module 的作用故起名为 bmAxios。 44 | 45 | ```js 46 | // 头文件里面比较简单只需要 遵循 WXModuleProtocol 协议 47 | // BMAxiosNetworkModule.h 48 | // 49 | #import 50 | #import "BMModuleProtocol.h" 51 | 52 | // 遵循 WXModuleProtocol 协议 53 | @interface BMAxiosNetworkModule : NSObject 54 | 55 | @end 56 | 57 | // 实现文件 58 | // BMAxiosNetworkModule.m 59 | // 60 | #import "BMAxiosNetworkModule.h" 61 | #import "BMAxiosRequestModel.h" 62 | #import "BMCommonRequest.h" 63 | #import "BMBaseViewController.h" 64 | #import "BMUserInfoModel.h" 65 | 66 | @implementation BMAxiosNetworkModule 67 | 68 | // 绑定一个 weexInstance 实例 69 | @synthesize weexInstance; 70 | 71 | // 将方法暴露出去,这个一定要添加,不然 js 端调不到这个方法 72 | WX_EXPORT_METHOD(@selector(fetch:callback:)) 73 | 74 | /** 75 | 方法实现 76 | 77 | @param info:js调用方法传递的参数 78 | @param callback: 通过callback 将结果数据回传给 js 79 | */ 80 | - (void)fetch:(NSDictionary *)info callback:(WXModuleCallback)callback 81 | { 82 | /* 添加判断 */ 83 | if (![info isKindOfClass:[NSDictionary class]]) { 84 | WXLogError(@"js request info Error"); 85 | return; 86 | } 87 | 88 | // 解析 info 89 | BMAxiosRequestModel *requestModel = [BMAxiosRequestModel yy_modelWithJSON:info]; 90 | // 创建请求 91 | BMCommonRequest *api = [[BMCommonRequest alloc] initWithRequestModel:requestModel]; 92 | 93 | [((BMBaseViewController *)weexInstance.viewController) addRequest:api]; 94 | // 触发请求 95 | [api startRequestResult:^(id data) { 96 | 97 | WXLogInfo(@"request data: %@",data); 98 | // 将数据结果回传给 js 99 | if (callback) { 100 | callback(data); 101 | } 102 | 103 | }]; 104 | } 105 | 106 | ``` 107 | 108 | **注册 module** 109 | 110 | 通过调用 WXSDKEngine 中的 `registerModule:withClass`方法来注册自己的module
111 | > 本工程中自定义的所有Module和Component都是在 `BMConfigManager.m` 文件中注册的 112 | 113 | ```js 114 | + (void)registerBmModules 115 | { 116 | NSDictionary *modules = @{ 117 | @"bmAxios": NSStringFromClass([BMAxiosNetworkModule class]) 118 | }; 119 | 120 | for (NSString *moduleName in modules.allKeys) { 121 | [WXSDKEngine registerModule:moduleName withClass:NSClassFromString([modules valueForKey:moduleName])]; 122 | } 123 | } 124 | ``` 125 | 126 | **js 调用 module** 127 | 128 | ```js 129 | // 引用方式 130 | var axios = weex.requireModule('bmAxios') 131 | 132 | // 示例 133 | axios.fetch({ 134 | method: 'GET' // 请求类型 GET or POST 135 | url: 'http://xxx/xxx', // 请求api,完整地址 136 | header: {} // 自定义请求头requestHeader 137 | data: {} // 请求参数 138 | }, function(resData){ 139 | // resData 数据 140 | }) 141 | ``` 142 | 143 | ## Component 扩展 144 | 145 | Weex 官方已经扩展了一些比较基础的 Component,利用这些组件可以写出一些基本的页面,但在实际开发过程中,有些复杂的页面使用这些组件写起来可能会比较麻烦,或者之前 native 端已经写好的一些炫酷的原生 view 想要在weex中使用,都可以通过 Component 的方式来实现。自定义 Component 的基本步骤: 146 | 147 | 1. 新建类继承 WXComponent 148 | 2. 实现初始化方法,解析 styles、attributes 149 | 3. 实现 `loadView`方法,初始化自定义 view 150 | 4. 可以再 `viewDidLoad`方法中设置一些 view 属性等 151 | 4. 实现 `addEvent:` 方法,绑定事件 152 | 5. 通过宏 `WX_EXPORT_METHOD`将必要的方法暴露给 js 153 | 6. 如果 `attributes` 需要动态变化需要实现方法 `updateAttributes:`,重新解析 attributes 154 | 7. 通过调用 fireEvent:params 方法触发 js 绑定的事件 155 | 156 | 下面是 `BMCalenderComponent` 的示例: 157 | 158 | ```js 159 | 新建一个 BMCalendarComponent 类继承 WXComponent 160 | 头文件 161 | // BMCalendarComponent.h 162 | // 163 | 164 | #import 165 | 166 | @interface BMCalendarComponent : WXComponent 167 | 168 | @end 169 | 170 | 171 | 172 | 实现文件 173 | (我们的日历组件是基于 FSCalendar 实现的) 174 | // 175 | // BMCalendarComponent.m 176 | // 177 | @interface BMCalendarComponent() 178 | 179 | // 暴露给 js 的方法 180 | WX_EXPORT_METHOD(@selector(goPrve)) 181 | WX_EXPORT_METHOD(@selector(goNext)) 182 | 183 | /** 184 | * 初始化方法 通过 185 | * @param ref component 标示 186 | * @param type component 类型 这里是 bmCalendar 187 | * @param styles js 定义的样式 188 | * @param attributes js 定义的属性 189 | * @param events js 绑定的事件 190 | * @param weexInstance 关联的 weex 实例 191 | */ 192 | -(instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDictionary *)styles attributes:(NSDictionary *)attributes events:(NSArray *)events weexInstance:(WXSDKInstance *)weexInstance 193 | { 194 | self = [super initWithRef:ref type:type styles:styles attributes:attributes events:events weexInstance:weexInstance]; 195 | if (self) { 196 | 197 | // component 中所有的 style,attribute,events 都会被传递到 Component 的初始化方法中,在这里可以解析这些信息 198 | _finishEvent = NO; 199 | self.maximumDate = attributes[@"maximumDate"]; 200 | self.minimumDate = attributes[@"minimumDate"]; 201 | 202 | if (attributes[@"selectType"]) { 203 | self.selectType = [WXConvert NSString:attributes[@"selectType"]]; 204 | } 205 | ... 206 | ... 207 | [self fillCSSStyles:styles]; 208 | } 209 | return self; 210 | } 211 | 212 | -(UIView*)loadView 213 | { 214 | // 初始化自定义 view 215 | FSCalendar *calendar = [[FSCalendar alloc] init]; 216 | ... 217 | ... 218 | return calendar; 219 | } 220 | 221 | -(void)addEvent:(NSString *)eventName 222 | { 223 | // 解析事件 这里标示需要触发 finish 事件 224 | if ([eventName isEqualToString:k_finishEvent]) { 225 | _finishEvent = YES; 226 | } 227 | } 228 | 229 | // 实现暴露给 js 的方法 230 | -(void)goPrve 231 | { 232 | [self previousClicked]; 233 | 234 | } 235 | // 实现暴露给 js 的方法 236 | -(void)goNext 237 | { 238 | [self nextClicked]; 239 | } 240 | 241 | -(void)fireMsg 242 | { 243 | ... 244 | // 触发 event 245 | if (_finishEvent) { 246 | [self fireEvent:k_finishEvent params:[self callbackParams]]; 247 | } 248 | } 249 | 250 | @end 251 | 252 | ``` 253 | 254 | **注册 Component** 255 | 256 | 与注册 Module 类似,调用 WXSDKEngine 中的 `registerComponent:withClass:` 方法 257 | 258 | ```js 259 | + (void)registerBmComponents 260 | { 261 | NSDictionary *components = @{ 262 | @"bmcalendar": NSStringFromClass([BMCalendarComponent class]) 263 | }; 264 | for (NSString *componentName in components) { 265 | [WXSDKEngine registerComponent:componentName withClass:NSClassFromString([components valueForKey:componentName])]; 266 | } 267 | } 268 | ``` 269 | -------------------------------------------------------------------------------- /zh-cn/other_plugin.md: -------------------------------------------------------------------------------- 1 | 2 | # Thank You, Open Source! 3 | **Eros 并非大团队维护,没有捐赠,纯靠热情,几个人的能力是有限的,所以请有能力的同学拿出你的热情,我们期待你的插件** 4 | 5 | ## 手势解锁 6 | 7 | 作者:[Shawn_tang](https://github.com/shawn-tangsc) [PoisonousMilkPowder](https://github.com/PoisonousMilkPowder)
8 | 插件地址:[iOS](https://github.com/shawn-tangsc/WeexPlugin-HMGesUnlock) [Android](https://github.com/PoisonousMilkPowder/WeexPlugin-HMGesUnlock) 9 | 10 | **效果展示:** 11 | 12 | ![](./image/gesunlock.gif) 13 | 14 | ## 日期选择器 15 | 16 | 作者:[qbmFE](https://github.com/qbmFE) 
17 | 插件地址:[iOS](https://github.com/qbmFE/eros-plugin-IOS-dateTimePicker) [Android](https://github.com/qbmFE/eros-plugin-android-dateTimePicker) 18 | 19 | **效果展示:** 20 | 21 | ![](./image/qbmDatePicker.gif) 22 | 23 | ## 支付宝支付 24 | 作者:[HirahKong](https://github.com/HirahKong) [zhongdong](https://github.com/zhongdom)
25 | 插件地址:[Android](https://github.com/HirahKong/eros-plugin-android-alipay) [iOS](https://github.com/zhongdom/eros-plugin-iOS-alipay) -------------------------------------------------------------------------------- /zh-cn/plugin_amap.md: -------------------------------------------------------------------------------- 1 | # Amap(1.0.0) 2 | 3 | > 功能简介:高德地图相关,`ErosPluginAmap`组件对[Weex-Amap](https://github.com/weex-plugins/weex-amap)进行了封装,便于大家集成使用 4 | 5 | ## 集成方式 6 | 7 | **iOS集成方式** 8 | 9 | * 打开iOS目录`工程目录/platforms/ios/WeexEros`,编辑Podfile文件,添加`ErosPluginAmap`组件的引用,添加代码如下 10 | 11 | ```ruby 12 | def common 13 | ...忽略其他库的引用 14 | # 在这里添加引用 ErosPluginWXShare 15 | pod 'ErosPluginAmap', :git => 'https://github.com/bmfe/eros-plugin-ios-amap.git', :tag => '1.0.0' 16 | end 17 | target 'WeexEros' do 18 | common 19 | end 20 | ``` 21 | 22 | * 在终端中`cd`到此目录下执行 `pod update`,等待命令执行完毕,重新运行项目,如果没有报错则说明该组件集成成功; 23 | 24 | **Android集成方式** 25 | 26 | * 进入Android目录`工程目录/platforms/android/WeexFrameworkWrapper/` 目录下 clone 对应的插件。 27 | 28 | ``` java 29 | git clone https://github.com/bmfe/eros-plugin-android-amap.git "ErosPluginAmap" 30 | ``` 31 | 32 | > 具体版本为Tag,如果您需要使用指定版本的话可以切换到指定的Tag. 33 | 34 | * 打开Android目录`工程目录/platforms/android/WeexFrameworkWrapper/`,编辑`settings.gradle`,添加引入。 35 | 在`settings.gradle` 中 添加如下代码。 36 | 37 | ``` java 38 | //这里只需要在最后添加 , ':erospluginamap' 39 | include ':app',':sdk',':nexus', ':wxframework', ':erospluginamap' 40 | 41 | // Amap 42 | project(':erospluginamap').projectDir = new File(settingsDir,'/ErosPluginAmap/ErosPluginAmap') 43 | 44 | ``` 45 | 46 | * 打开Android目录`工程目录/platforms/android/WeexFrameworkWrapper/app`,编辑app目录下`build.gradle` 文件 `dependencies` 下添对应 插件引用。 47 | 48 | ``` java 49 | dependencies { 50 | .... 51 | compile project(':erospluginamap') 52 | } 53 | ``` 54 | * 最后记得点击右上角sync now 55 | 56 | * 具体Android 插件详细集成方式 您还可以参考[Android 插件依赖](/zh-cn/android_plugin_integration) 57 | 58 | 59 | ## 使用 60 | 61 | * 引用Module 62 | 63 | ```js 64 | var amap = weex.requireModule('amap') 65 | ``` 66 | 67 | **Api** 68 | 69 | * 初始化方法 initAmap('appkey') 70 | 71 | ```js 72 | amap.initAmap('appkey') 73 | ``` 74 | 75 | 其他使用方法请参考Weex-Amap使用教程 76 | 77 | 引用[Weex-Amap](https://github.com/weex-plugins/weex-amap)官方教程 78 | 79 | 一款高德地图weex插件,当前版本支持定位,缩放等地图常用操作。 80 | 请配合[高德地图开发文档](http://lbs.amap.com/api/android-sdk/summary/)使用该插件 81 | 82 | ### 快速开始 83 | 84 | 编辑您的weex文件 85 | 86 | ```js 87 | 94 | 95 | 107 | 108 | 126 | 127 | ``` 128 | 129 | ### API 130 | 131 | #### weex-amap 属性 132 | 133 | | 属性 | 类型 | Demo | 描述 | 134 | | ------------- |:-------------:| -----:|----------:| 135 | | sdkKey | object | {ios:'xxx',android: 'xxx',h5: 'xxx'} | 指定开发者的 SDK 密匙 136 | | scale | boolean | true | 设置比例尺功能是否可用 137 | | center | array | [116.487, 40.00003] | 传入地理位置坐标[x,y] 默认为当前定位位置 | 138 | | zoom | number | 合法值范围 [3,19] | 缩放级别 | 139 | | compass | boolean | true | 是否允许显示指南针 | 140 | | zoomEnable | boolean | true | 是否允许缩放 141 | | marker | array | [`{position:[116,12]}]` | 点标记物的属性 142 | | geolocation | boolean | true | 是否显示当前位置 143 | | zoomPosition | String | center|bottom | 设置缩放按钮的位置 144 | | gestures | String | ["zoom","rotate","tilt","scroll"] | 设置允许对地图做哪些手势操作 145 | | myLocationEnabled | boolean | true | 定位按钮是否显示 146 | | showMyLocation | boolean | true | 是否显示当前位置 147 | | customEnabled | boolean | true | 是否开启自定义地图样式 148 | | setMapCustomEnable | String | {"android":"/data/custom_map"} |设置自定义地图资源文件的路径 149 | | indoorswitch | boolean | false |设置室内地图楼层切换控件是否可见 150 | 151 | 152 | **建议您前往[高德开发者社区](http://lbs.amap.com/)申明您对应产品的Key,保证地图正常工作** 153 | 154 | #### weex-amap 事件 155 | **zoomchange** 156 | 用户缩放地图时触发该事件 157 | 事件格式 158 | ```json 159 | { 160 | "targetCoordinate" : "缩放后的位置", 161 | "zoom" : "目标可视区域的缩放级别。", 162 | "tilt" : "目标可视区域的倾斜度,以角度为单位。", 163 | "bearing" : "可视区域指向的方向,以角度为单位,从正北向逆时针方向计算,从0 度到360 度。", 164 | "isAbroad" : "该位置是否在国内(此属性不是精确计算,不能用于边界区域)", 165 | "scalePerPixel" : "Weex中一像素对应实际距离的长度(单位米)", 166 | "visibleRegion" : "可视区域的范围" 167 | } 168 | ``` 169 | **dragend** 170 | 用户拖动地图时触发该事件 171 | 172 | 173 | 174 | #### weex-amap-marker 属性 175 | 176 | | 属性 | 类型 | Demo | 描述 | 177 | | ------------- |:-------------:| -----:|----------:| 178 | | position | array | [116.487, 40.00003] | 传入地理位置坐标[x,y] 默认为当前定位位置 | 179 | | icon | string | some_icon_url | 图标的url地址 | 180 | | title | string | 'this is a marker' | 坐标点的名称 | 181 | | hideCallout | boolean | true | 设置marker是否可点击 | 182 | | open | boolean | true | 是否显示InfoWindow | 183 | 184 | #### weex-amap-marker 事件 185 | **click** 186 | 点击marker时触发 187 | 188 | #### weex-amap-info-window 属性 189 | 190 | | 属性 | 类型 | 描述 | 191 | | ------------- |:-------------:| -----:| 192 | | open | boolean | 是否显示InfoWindow | 193 | | position | String | InfoWindow位置 | 194 | | offset | String | InfoWindow偏移量 | 195 | 196 | #### weex-amap-circle 属性 197 | | 属性 | 类型 | 描述 | 198 | | ------------- |:-------------:| -----:| 199 | | center | String | 中心点 | 200 | | strokeColor | String | 描边颜色 | 201 | | fillColor | String | 填充颜色 | 202 | | strokeWidth | float | 描边宽度 | 203 | | radius | float | 半径 | 204 | 205 | #### weex-amap-polygon 属性 206 | 207 | | 属性 | 类型 | 描述 | 208 | | ------------- |:-------------:| -----:| 209 | | path | String | 路径 | 210 | | strokeColor | String | 描边颜色 | 211 | | fillColor | String | 填充颜色 | 212 | | strokeWidth | float | 描边宽度 | 213 | 214 | #### weex-amap-polyline 属性 215 | 216 | | 属性 | 类型 | 描述 | 217 | | ------------- |:-------------:| -----:| 218 | | path | String | 路径 | 219 | | strokeColor | String | 描边颜色 | 220 | | strokeStyle | String | 描边样式,可为dashed或空 | 221 | | strokeWidth | float | 描边宽度 | 222 | 223 | #### Amap 模块 224 | 225 | ##### getUserLocation("weex-amap的ref",callback) 226 | 227 | + completeFunc 定位成功后的回调函数,返回的数据: 228 | ``` 229 | { 230 | data:{ 231 | position: [] 232 | }, 233 | result: 'success' 234 | } 235 | ``` 236 | 237 | ##### getLineDistance(posA, posB, callback) 238 | 239 | + 获取两点间的直线距离 240 | 241 | ##### polygonContainsMarker(position, id, callback) 242 | 243 | + 判断点是否在合围范围内 244 | 245 | ##### 使用Amap模块 246 | 247 | ``` html 248 | 255 | 256 | 275 | ``` 276 | -------------------------------------------------------------------------------- /zh-cn/plugin_getui_push.md: -------------------------------------------------------------------------------- 1 | # bmPush 2 | 3 | > 功能简介:基于GeTuiSDK实现的消息推送服务; 4 | 5 | ## 集成方式 6 | 7 | **iOS集成方式** 8 | 9 | * 打开iOS目录`工程目录/platforms/ios/WeexEros`,编辑Podfile文件,添加`ErosPluginGeTui`组件的引用,添加代码如下(注意修改版本号) 10 | 11 | ```ruby 12 | def common 13 | ...忽略其他库的引用 14 | # 在这里添加引用 ErosPluginWXShare 15 | pod 'ErosPluginGeTui', :git => 'https://github.com/bmfe/eros-plugin-ios-getui.git', :tag => '版本号' 16 | end 17 | target 'WeexEros' do 18 | common 19 | end 20 | ``` 21 | 22 | * 在终端中`cd`到此目录下执行 `pod update`,等待命令执行完毕,重新运行项目,如果没有报错则说明该组件集成成功; 23 | 24 | **Android集成方式** 25 | 26 | * 1、打开Android目录`工程目录/platforms/android/WeexFrameworkWrapper/app/src/main`,编辑app目录下AndroidManifest.xml 文件 `application` 节点下添加引用,代码如下 27 | ```java 28 | 31 | 34 | 37 | 38 | 41 | 42 | 43 | 44 | 45 | ``` 46 | * 2、`工程目录/platforms/android/WeexFrameworkWrapper`,目录下 gradle.properties 添加 个推相关key 47 | ```java 48 | GETUI_APPID= your app id 49 | GETUI_APPKEY= your app key 50 | GETTUI_APPSECRET= your app secret 51 | ``` 52 | * 3、按照 [Android 插件依赖](/zh-cn/android_plugin_integration) 下载代码添加依赖 53 | 54 | * 添加完后,右上角 有一个 sync now。 点击 等待同步完成没有报错证明组件添加成功 55 | 56 | ## 使用 57 | > 在使用推送之前,首先您需要按照[个推文档](http://docs.getui.com/getui/start/ios/)去个推申请一个账号,并注册app,获取appId、appKey和appSecret,并在 `eros.native.js` 中填写相关参数 58 | 59 | * 引用Module 60 | 61 | ```js 62 | var bmPush = weex.requireModule('bmPush') 63 | ``` 64 | 65 | **API** 66 | 67 | * 初始化方法 `initPush(info)` 68 | 69 | > 在使用推送之前,请调用此方法进行初始化。 70 | 71 | ```js 72 | bmPush.initPush({ 73 | appId: '', // appId、appKey、appSecret 需要到个推后台获取 74 | appKey: '', 75 | appSecret: '' 76 | }) 77 | ``` 78 | * 获取cid `getCid()` 79 | 80 | ```js 81 | bmPush.getCid(result => { 82 | console.log(result.data.cid) 83 | }) 84 | ``` 85 | 86 | * 这个时候,当您用真机启动应用的时候,您的cid和deviceToken就会上传注册到个推官网。也就是说恭喜您,您现在可以接收到推送了 87 | 88 | * Android 配置 appkey 打开Android目录`工程目录/platforms/android/WeexFrameworkWrapper/gradle.properties` 文件里 89 | GETUI_APPID、GETUI_APPKEY、GETTUI_APPSECRET 配置key 等信息 90 | * Android 进行测试时,需额外在res文件夹中添加app_icon.png以及push_small.png两张图片来修改通知栏默认的图标样式 91 | 92 | ###个推官网后台推送测试 93 | 94 | * 进入您个推账号的开发者中心,然后选择您创建的应用点击创建推送。 95 | 96 | * 进入后选择透传消息(具体的差别可以看个推官方文档,最大的差别就是ios只收得到透传消息)。 97 | 98 | * 这里比较关键,因为原生端在收取站内推送的时候做了特殊处理,所以您需要传的消息格式是一个 99 | 100 | ``` 101 | {"payload":} 102 | ``` 103 | 104 | 所以,您可以直接把下面贴到个推官网的消息内容里 105 | 106 | ``` 107 | {"payload":"{\"aps\":{\"alert\":\"test\"}}"} 108 | ``` 109 | 也可以将您要的标准json通过下列方式贴进去 110 | 111 | addGetuiJson![](https://raw.githubusercontent.com/myliuyx/source/master/addGetuiJson.jpeg) 112 | * 下图是各参数的解释 113 | 114 | getui![](https://raw.githubusercontent.com/myliuyx/source/master/getui.jpg) 115 | 116 | ### 应用内如何接受 117 | 118 | * 在demo的config目录中,有一个push.js 文件。 119 | 120 | ```js 121 | globalEvent.addEventListener('pushMessage', function (options) { 122 | modal.alert({ 123 | message: 'hello'+JSON.stringify(options), 124 | duration: 0.3 125 | }, function (value) { 126 | console.log('alert callback', value) 127 | }) 128 | console.log('》》》》》》》》'+JSON.stringify(options)); 129 | }) 130 | 131 | ``` 132 | 您可以选择把消息用弹框弹出来,也可以直接看一下控制台。有特殊处理,就在这里直接处理就好了。 133 | 134 | ### 后台调试 135 | * 个推数据返回格式 136 | 137 | ```js 138 | { 139 | "payload":{ 140 | "aps":{ 141 | "alert":"test", 142 | } 143 | } 144 | } 145 | ``` 146 | > {"payload":"{\"aps\":{\"alert\":\"tes11\"}}"} 可直接复制此字符串直接去个推后台透传推送 147 | 148 | * 后端代码(java) 149 | 150 | ```java 151 | AppConfig appConfig = appSelector.getAppConfig(context.getTemplate()); 152 | Map templateMap = context.getTemplate().getTemplateConfig().getExtConfig(); 153 | Map extMap = templateMap.entrySet().stream() 154 | .filter(entry -> entry.getKey().startsWith("GT_")) 155 | .collect(Collectors.toMap(entry -> entry.getKey().substring("GT_".length()), 156 | Entry::getValue)); 157 | 158 | SingleMessage message = new SingleMessage(); 159 | message.setOffline(true); 160 | message.setOfflineExpireTime(TimeUnit.DAYS.toMillis(1)); 161 | //判断是否客户端是否wifi环境下推送,1为在WIFI环境下,0为不限制网络环境。 162 | message.setPushNetWorkType(0); 163 | TransmissionTemplate template = appConfig.getBuilder() 164 | .setContent(context.getTemplate().getContent()) 165 | .setExt(extMap) 166 | .build(); 167 | message.setData(template); 168 | 169 | //2. create target 170 | Target target = new Target(); 171 | target.setAppId(appConfig.getAppId()); 172 | target.setClientId(context.getReceiver().getCid()); 173 | IPushResult ret = null; 174 | 175 | try { 176 | ret = appConfig.getiGtPush().pushMessageToSingle(message, target); 177 | logger.info("app消息推送返回结果:{}", JsonUtil.of(ret)); 178 | } catch (RequestException e) { 179 | logger.error("app推送消息出现异常:{}:{}", message, ret, e); 180 | ret = appConfig.getiGtPush().pushMessageToSingle(message, target, e.getRequestId()); 181 | } 182 | // TransmissionTemplate 相关代码 183 | public TransmissionTemplate build() { 184 | TransmissionTemplate transmissionTemplate = new TransmissionTemplate(); 185 | transmissionTemplate.setAppId(this.appId); 186 | transmissionTemplate.setAppkey(this.appKey); 187 | transmissionTemplate.setTransmissionType(this.transmissionType); 188 | 189 | APNPayload payload = new APNPayload(); 190 | payload.setBadge(1); 191 | payload.setContentAvailable(1); 192 | payload.setSound("default"); 193 | payload.setCategory("$由客户端定义"); 194 | payload.setAlertMsg(new APNPayload.SimpleAlertMsg(content)); 195 | this.ext.entrySet().forEach(entry -> { 196 | payload.addCustomMsg(entry.getKey(), entry.getValue()); 197 | }); 198 | transmissionTemplate.setTransmissionContent(JsonUtil.of(payload)); 199 | //推送模式 200 | if (!transmission) { 201 | transmissionTemplate.setAPNInfo(payload); 202 | 203 | } 204 | return transmissionTemplate; 205 | } 206 | 207 | ``` 208 | > 关键代码是 TransmissionTemplate 的 transmissionTemplate.setAPNInfo(payload); 209 | message.setData(template); 210 | 把 template 当做 message 的data 211 | 212 | ## Change Log 213 | 214 | **iOS 1.0.1** 2018.05.30
215 | 216 | * 修复点击推送消息唤起App崩溃的问题; 217 | -------------------------------------------------------------------------------- /zh-cn/plugin_umAnalytics.md: -------------------------------------------------------------------------------- 1 | # bmUMAnalytics 2 | 3 | > 功能简介:该插件集成了友盟统计SDK,目前只支持基本的数据统计,比如装机量,用户数据等,用法非常简单,只需要调用初始化方法即可; 4 | 5 | 6 | ## 集成方式 7 | **iOS集成方式** 8 | 9 | * 打开iOS目录`工程目录/platforms/ios/WeexEros`,编辑Podfile文件,添加`ErosPluginUMAnalytics`组件的引用,添加代码如下,**注意**版本号改为最新的版本(请看change log) 10 | 11 | ```ruby 12 | def common 13 | ...忽略其他库的引用 14 | # 在这里添加引用 ErosPluginUMAnalytics 15 | pod 'ErosPluginUMAnalytics', :git => 'https://github.com/bmfe/eros-plugin-ios-UMAnalytics.git', :tag => '版本号' 16 | end 17 | target 'WeexEros' do 18 | common 19 | end 20 | ``` 21 | 22 | * 在终端中`cd`到此目录下执行 `pod update`,等待命令执行完毕,重新运行项目即可。 23 | 24 | **Android集成方式** 25 | 26 | * 进入Android目录`工程目录/platforms/android/WeexFrameworkWrapper/` 目录下 clone 对应的插件。 27 | 28 | ``` ruby 29 | git clone https://github.com/bmfe/eros-plugin-android-UMAnalytics.git "erospluginum" 30 | ``` 31 | 32 | * 打开Android目录`工程目录/platforms/android/WeexFrameworkWrapper/`,编辑`settings.gradle`,添加引入。 33 | 在`settings.gradle` 中 添加如下代码。 34 | 35 | ``` ruby 36 | //这里只需要在最后添加 , ':erospluginum' 37 | include ':app',':sdk',':nexus', ':wxframework', ':erospluginum' 38 | ``` 39 | 40 | * 打开Android目录`工程目录/platforms/android/WeexFrameworkWrapper/app`,编辑app目录下`build.gradle` 文件 `dependencies` 下添对应 插件引用。 41 | 42 | ``` ruby 43 | dependencies { 44 | .... 45 | //umeng 46 | compile project(':erospluginum') 47 | } 48 | ``` 49 | * 点击右上角 `Sync Now` 50 | 51 | ## 使用 52 | 53 | **引用Module** 54 | 55 | ```js 56 | var bmUMAnalytics = weex.requireModule('bmUMAnalytics') 57 | ``` 58 | 59 | **API** 60 | 61 | * 初始化友盟SDK `initUM('appkey')` 62 | 63 | > 调用此方法初始化友盟SDK 64 | 65 | ```js 66 | bmUMAnalytics.initUM('友盟平台申请的appkey') 67 | ``` 68 | 69 | * 统计事件次数 `event('eventId')` 70 | 71 | > 自定义事件,数量统计. 72 | 使用前,请先到友盟App管理后台的设置->编辑自定义事件 中添加相应的事件ID,然后在工程中传入相应的事件ID 73 | 74 | ```js 75 | bmUMAnalytics.event('clickLogin') 76 | ``` 77 | 78 | * 统计页面展示时长 开始 `beginPage('pageName')` , 结束`endPage('pageName')` 79 | 80 | > 必须成对调用,可结合`eros`页面生命周期统计页面展示时长 81 | 82 | ```js 83 | // 页面展示时调用 84 | bmUMAnalytics.beginPage('pageName') 85 | // 页面关闭时调用 86 | bmUMAnalytics.endPage('pageName') 87 | ``` 88 | 89 | * 统计事件时长 开始 `beginEvent('eventId')` , 结束`endEvent('eventId')` 90 | 91 | > 必须成对调用,可结合`eros`页面生命周期统计页面展示时长 92 | 93 | ```js 94 | // 事件开始调用 95 | bmUMAnalytics.beginEvent('eventId') 96 | // 事件结束调用 97 | bmUMAnalytics.endEvent('eventId') 98 | ``` 99 | 100 | ## 注意事项 101 | **iOS 提交审核** 时需要正确设置 IDFA 选项,如下图 102 | ![idfa](./image/idfaSet.png) 103 | 104 | ## Change Log 105 | 106 | **iOS 1.0.1**
107 | 1.添加自定义事件统计api; 108 | 109 | **iOS 1.0.0**
110 | 1.集成友盟统计; 111 | 112 | **Android 1.0.0**
113 | 1.集成友盟统计; 114 | 115 | -------------------------------------------------------------------------------- /zh-cn/plugin_wx_pay.md: -------------------------------------------------------------------------------- 1 | # bmWXPay 2 | 3 | > 功能简介:调用微信支付 4 | 5 | ## 集成方式 6 | 7 | **iOS集成方式** 8 | 9 | * 打开iOS目录`工程目录/platforms/ios/WeexEros`,编辑Podfile文件,添加`ErosPluginWXPay`组件的引用,添加代码如下 10 | 11 | ```ruby 12 | def common 13 | ...忽略其他库的引用 14 | # 在这里添加引用 ErosPluginWXShare 15 | pod 'ErosPluginWXPay', :git => 'https://github.com/bmfe/eros-plugin-ios-wxpay.git', :tag => '版本号请看页面最下面change log' 16 | end 17 | target 'WeexEros' do 18 | common 19 | end 20 | ``` 21 | 22 | * 在终端中`cd`到此目录下执行 `pod update`,等待命令执行完毕,重新运行项目,如果没有报错则说明`ErosPluginWXPay`组件集成成功; 23 | 24 | **Android集成方式** 25 | 26 | 27 | * 进入Android目录`工程目录/platforms/android/WeexFrameworkWrapper/` 目录下 clone 对应的插件。 28 | 29 | ``` ruby 30 | git clone https://github.com/bmfe/eros-plugin-android-wxpay.git "erospluginwxpay" 31 | ``` 32 | 33 | * 打开Android目录`工程目录/platforms/android/WeexFrameworkWrapper/`,编辑`settings.gradle`,添加引入。 34 | 在`settings.gradle` 中 添加如下代码。 35 | 36 | ``` ruby 37 | //这里只需要在最后添加 , ':erospluginwxpay' 38 | include ':app',':sdk',':nexus', ':wxframework', ':erospluginwxpay' 39 | 40 | // 微信支付 41 | project(':erospluginwxpay').projectDir = new File(settingsDir,'/erospluginwxpay/library-wxpay') 42 | 43 | ``` 44 | 45 | * 打开Android目录`工程目录/platforms/android/WeexFrameworkWrapper/app`,编辑app目录下`build.gradle` 文件 `dependencies` 下添对应 插件引用。 46 | 47 | ``` ruby 48 | dependencies { 49 | .... 50 | //微信支付 51 | compile project(':erospluginwxpay') 52 | } 53 | ``` 54 | 55 | * 打开Android目录工程目录`/platforms/android/WeexFrameworkWrapper/app/src/main/java/com/benmu/wx/wxapi`,编辑目录下的`WXEntryActivity.java`和`WXPayEntryActivity.java`解开注释,编辑`WXPayEntryActivity.java` 56 | 57 | ``` ruby 58 | api.registerApp(WXApiModule.getInstans().getAppId()) 59 | //修改为 60 | api.registerApp("你的wx appID") 61 | ``` 62 | 63 | * 更改Android目录工程目录`/platforms/android/WeexFrameworkWrapper/app/src/main/AndroidManifest.xml` 64 | ``` ruby 65 | 68 | ..... 69 | 70 | 73 | 74 | ``` 75 | 76 | * 更改Android目录工程目录`/platforms/android/WeexFrameworkWrapper/app/src/main/java`目录下`com.benmu.wx`为你的包名,点击右上角sync now根据提示修改报错的地方com.benmu.wx为你的包名 77 | 78 | * 具体Android 插件详细集成方式 您还可以参考[Android 插件依赖](/zh-cn/android_plugin_integration) 79 | 80 | * 具体Android 相关[微信Key和签名申请参考文档](/zh-cn/android_wx_apply) 81 | 82 | ## 使用 83 | 84 | 引用Module 85 | 86 | ```js 87 | var bmWXPay = weex.requireModule('bmWXPay') 88 | ``` 89 | 90 | **API** 91 | 92 | * 初始化微信SDK `initWX('appkey')` 93 | 94 | ```js 95 | bmWXPay.initWX('appkey') 96 | ``` 97 | * 判断是否安装微信app `isInstallWXApp()` ,使用该方法必须先调用初始化方法 98 | 99 | > 在使用微信支付功能之前应该判断是否安装了微信app,如果没有安装应该隐藏相关功能按钮 100 | 101 | ```js 102 | // 同步方法 103 | var result = bmWXPay.isInstallWXApp() 104 | ``` 105 | 106 | * 支付 `pay(info,callback)` 107 | 108 | > 调用微信支付之前所需参数应用有服务器端先调用微信相关接口生成预支付订单,然后将app所需要参数返回,请参考[微信官方文档](https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_1)。 109 | 110 | ```js 111 | bmWXPay.pay({ 112 | // 微信支付所需必要参数 113 | appid:'', 114 | sign:'', 115 | timestamp:'', 116 | noncestr:'', 117 | partnerid:'', 118 | prepayid:'', 119 | packageValue:'' 120 | },function(resData){ 121 | // 支付结果 122 | // resDate.status 说明 123 | 0, /**< 成功 */ 124 | -1, /**< 普通错误类型 */ 125 | -2, /**< 用户点击取消并返回 */ 126 | -3, /**< 发送失败 */ 127 | -4, /**< 授权失败 */ 128 | -5, /**< 微信不支持 */ 129 | }) 130 | ``` 131 | 132 | ## Chage Log 133 | **Android 1.0.1** 134 | * 修复微信支付模块 isInstallWXApp方法无效问题. 135 | 136 | **iOS 1.0.2**
137 | * 再次修复获取是否安装微信方法走内置包时无效的问题; 138 | 139 | **iOS 1.0.1**
140 | * 修复获取判断是否安装微信方法无效的问题; 141 | 142 | -------------------------------------------------------------------------------- /zh-cn/plugin_wx_share.md: -------------------------------------------------------------------------------- 1 | # bmWXShare 2 | 3 | > 功能简介:基于友盟ShareSDK实现,微信分享(分享到朋友圈,微信好友)及微信授权登录; 4 | > 在使用分享之前,还需要一些配置
5 | 1.首先请到友盟平台注册App获取AppKey;
6 | 2.iOS平台请参考友盟的[教程](https://developer.umeng.com/docs/66632/detail/66825)配置SSO白名单、及 URL Scheme;
7 | 3.Android AppId一定要填写对,并且微信后台需要填写app签名,详情请看微信官方教程;
8 | 4.为了让大家更灵活的根据产品定制样式,插件化版本的 分享UI 需要用户自行处理。 9 | 10 | 11 | ## 集成方式 12 | **iOS集成方式** 13 | 14 | * 打开iOS目录`工程目录/platforms/ios/WeexEros`,编辑Podfile文件,添加`ErosPluginWXShare`组件的引用,添加代码如下,**注意**版本号改为最新的版本(请看Change log) 15 | 16 | ```ruby 17 | def common 18 | ...忽略其他库的引用 19 | # 在这里添加引用 ErosPluginWXShare 20 | pod 'ErosPluginWXShare', :git => 'https://github.com/bmfe/eros-plugin-ios-wxshare.git', :tag => '版本号请看页面最下面change log' 21 | end 22 | target 'WeexEros' do 23 | common 24 | end 25 | ``` 26 | 27 | * 在终端中`cd`到此目录下执行 `pod update`,等待命令执行完毕,重新运行项目,如果没有报错则说明`ErosPluginWXShare`组件集成成功; 28 | 29 | **Android集成方式** 30 | 31 | 32 | * 进入Android目录`工程目录/platforms/android/WeexFrameworkWrapper/` 目录下 clone 对应的插件。 33 | 34 | ``` java 35 | git clone https://github.com/bmfe/eros-plugin-android-wxshare.git "erospluginumeng" 36 | ``` 37 | 38 | > 具体版本为Tag,如果您需要使用指定版本的话可以切换到指定的Tag. 39 | 40 | 41 | * 打开Android目录`工程目录/platforms/android/WeexFrameworkWrapper/`,编辑`settings.gradle`,添加引入。 42 | 在`settings.gradle` 中 添加如下代码。 43 | 44 | ``` java 45 | //这里只需要在最后添加 , ':erospluginwxshare' 46 | include ':app',':sdk',':nexus', ':wxframework', ':erospluginwxshare' 47 | 48 | // 分享 49 | project(':erospluginwxshare').projectDir = new File(settingsDir,'/erospluginumeng/library-wxshare') 50 | 51 | ``` 52 | 53 | * 打开Android目录`工程目录/platforms/android/WeexFrameworkWrapper/app`,编辑app目录下`build.gradle` 文件 `dependencies` 下添对应 插件引用。 54 | 55 | ``` java 56 | dependencies { 57 | .... 58 | //分享 59 | compile project(':erospluginwxshare') 60 | } 61 | ``` 62 | 63 | * 最后记得点击右上角sync now 64 | 65 | * 具体Android 插件详细集成方式 您还可以参考[Android 插件依赖](/zh-cn/android_plugin_integration) 66 | 67 | * 具体Android 相关[微信Key和签名申请参考文档](/zh-cn/android_wx_apply) 68 | 69 | ## 使用 70 | 71 | **引用Module** 72 | 73 | ```js 74 | var bmWXShare = weex.requireModule('bmWXShare') 75 | ``` 76 | 77 | **API** 78 | 79 | * 初始化友盟SDK `initUM('appkey')` 80 | 81 | > 在使用之前,请先调用此方法初始化友盟SDK 82 | 83 | ```js 84 | bmWXShare.initUM('友盟平台申请的appkey') 85 | ``` 86 | 87 | * 初始化微信SDK `initWX(info)` 88 | 89 | > 在使用分享到微信平台功能,或者微信登录功能前,需要调用此方法来初始化微信平台; 90 | 91 | ```js 92 | bmWXShare.initWX({ 93 | appKey: 'appkey', // 微信开发平台申请的appkey 94 | appSecret: 'appSecret', // appKey对应的appSecret, 95 | redirectURL: '回调页面' // 授权回调页面 96 | }) 97 | ``` 98 | 99 | * 判断是否安装微信app `isInstallWXApp()` 使用该方法必须先调用初始化方法 100 | 101 | > 在使用微信分享或授权登录之前应该判断是否安装了微信app,如果没有安装应该隐藏相关功能按钮 102 | 103 | ```js 104 | // 同步方法 105 | var result = bmWXShare.isInstallWXApp() 106 | ``` 107 | 108 | * 分享:`share(info,successCallback,failedCallback)` 109 | 110 | ```js 111 | bmWXShare.share({ 112 | title:'', // 分享的标题 113 | content:'', // 分享的文字内容 114 | url: '', // 分享对应的URL地址,如h5、音乐链接、视频链接、小程序的链接 115 | image: '', // 分享的图片url 116 | path: '', // 分享小程序用到的页面路径 117 | userName: '' // 小程序名称 118 | shareType: 'Webpage', // 分享的类型 119 | platform: 'WechatSession' // 分享平台 朋友圈/好友(注意:历史版本的字段名是platforms,现在是一个字符串而不是数组) 120 | },function(resData){ // 注意: 历史版本返回的是一个promise对象,现在的是callback回调 121 | // 成功回调 122 | },function(resData){ 123 | // 失败回调 124 | }) 125 | 126 | // 分享平台 127 | platform:[ 128 | WechatSession, // 微信好友 129 | WechatTimeLine // 分享至朋友圈 130 | ] 131 | 132 | // 分享类型 133 | shareType:[ 134 | Text, // 文字 135 | Image, // 图片 136 | TextImage, // 图文 137 | Webpage, // 网页 138 | Music, // 音乐 139 | Video, // 视频 140 | MiniProgram // 小程序 141 | ] 142 | ``` 143 | 144 | * 微信授权登录:`authLogin(callback)` 145 | 146 | ```js 147 | bmWXShare.authLogin(function(resData){ 148 | // 授权结果,成功的话会将所有的userInfo返回 149 | // console.log(resData) 150 | }); 151 | ``` 152 | 153 | ## 注意事项 154 | **iOS 提交审核** 时需要正确设置 IDFA 选项,如下图 155 | ![idfa](./image/idfaSet.png) 156 | 157 | ## Change Log 158 | **Android 1.1.1**
159 | * 更新Umeng库 160 | 161 | **iOS 1.0.5**
162 | * 分享接口添加`userName`字段,分享小程序时需要传小程序的名字; 163 | 164 | **iOS 1.0.4**
165 | * 再次修复获取是否安装微信方法走内置包时无效的问题; 166 | 167 | **iOS 1.0.3**
168 | * 修复获取是否安装微信方法无效的问题; 169 | 170 | **iOS 1.0.2**
171 | * 修复shareType字段取值问题,导致只能分享网页; 172 | 173 | **iOS 1.0.1**
174 | * 修复友盟SDK报错的问题; 175 | -------------------------------------------------------------------------------- /zh-cn/recommend.md: -------------------------------------------------------------------------------- 1 | 2 | ## 插件 UI 组件库 3 | ### [AMUI](https://hminghe.github.io/weex-amui/#/?id=weex-amui) 4 | > 实现了大量 ui 组件,设计精美,值得推荐。 5 | 6 | ### [BUI-Weex](http://dev.bingocc.com/buiweex/docs/) 7 | > BUI-Weex 是一套专门为 Weex 前端开发者打造的一套高质量UI框架。为了达到更好的效果,请在 WeexSDK 0.11.0 + 上使用这套UI框架。BUI-Weex致力于为iOS和android平台提供丰富的UI组件,帮助开发者快速构建移动应用。 8 | 9 | ### [Weex-ui](https://github.com/alibaba/weex-ui) 10 | > weex 官方组件库,weex ui 库的鼻祖。 11 | 12 | ### [weex-flymeui](https://github.com/FlymeApps/weex-flymeui) 13 | > 遵循 Flyme 系统设计风格、基于 Weex 的跨平台通用组件库。 14 | 15 | 16 | ## 推荐阅读博文 17 | 18 | ### [深入了解 Weex](https://juejin.im/post/5b18a03ce51d45069d2263e3#comment) 19 | 20 | ### [浅谈混合应用的演进](https://juejin.im/post/5b189fc9f265da6e326c5104) 21 | 22 | ### [教程:EROS集成到现有iOS应用](https://zhuanlan.zhihu.com/p/38905196) 23 | -------------------------------------------------------------------------------- /zh-cn/tutorial_newcomer.md: -------------------------------------------------------------------------------- 1 | # 由来 2 | 3 | 我们需要先从 weex 说起 ,我们直接看原理图: 4 | ![weex原理](http://upload.ouliu.net/i/20171212234224psphf.jpeg) 5 | 6 | weex 原理图中分为了 Server 和 Client 两部分。 7 | #### Server 8 | **weex file:** 就是我们的 .vue 文件(或官方的 .we 文件),和我们平时进行前端开发的一样。 9 | 10 | **transformer:** 以 vue 开发为例,在浏览器中我们通常都会写 `.vue` 文件和 `es6` 等浏览器目前并不支持的语法,通过前端资源打包工具 `webpack` 等通过 `vue-loader`、`babel-loader`等最终转化成为 `es5` 代码,让浏览器识别,而在 weex 最终编译出来资源文件能在浏览器跑,自然也是这个道理。 11 | 12 | 而浏览器端运行的 `es5` 代码是无法直接运行在客户端的(如浏览器有 BOM,DOM,客户端是没有的),所以在通过 weex 来开发客户端有很多限制的。 13 | 14 | 在编译客户端静态资源文件的时候,是通过 `weex-loader` 来加载这些经过限制语法编写的 weex file,最终编译成为能让客户端读懂的 **JS 文件**,也就是 **JS Bundle**。 15 | 16 | 有兴趣的同学可以深入了解这部分内容。[深入Weex中的transformer实现原理](http://www.jianshu.com/p/109fdece22d2) 17 | 18 | 所以这块之所以叫 **server**,也就是这些静态资源文件可以在远端服务器打包生成,被客户端访问到并下载解析。 19 | 20 | #### Client 21 | 引用 weex 官网上的话。 22 | > Weex 的 iOS 和 Android 客户端中都会运行一个 JavaScript 引擎,来执行 JS bundle,同时向各端的渲染层发送规范化的指令,调度客户端的渲染和其它各种能力。我们在 iOS 下选择了 JavaScriptCore 内核,而在 Android 下选择了 UC 提供的 v8 内核。无论是从性能还是稳定性方面都提供了强有力的保障。 23 | 24 | > 为了让整个移动应用的资源利用得更好,我们在客户端提供的 JavaScript 引擎是单例的,即所有 JS bundle 公用一个 JavaScript 内核实例,同时对每个 JS bundle 在运行时进行了上下文的隔离,使得每个 JS bundle 都能够高效安全的工作。我们还把 Vue 2.0 这样的 JS Framework 做了预置,开发者不必把 JS Framework 打包在每个 JS bundle 里,从而大大减少了 JS bundle 的体积,也就进一步保障了页面打开的速度。 25 | 26 | **client** 对于前端来说肯定是越了解会更好,不了解也没关系,但 weex 有个功能是很重要的,那就是 weex 搭建起了一条 JS Bridge,通过客户端自定义 **module** 和 **component**,让前端与客户端有了交互能力。 27 | 28 | 而自定义 **module** 和 **component** 需要一定的客户端开发知识,让很多前端开发的同学,望而却步,又因为官方的环境搭建,脚手架打包等目前还存在一些问题,把很多想学习 weex 的同学拦在了外面,所以 eros 因应而生。 29 | 30 | [weex 官方文档](http://weex.apache.org/cn/guide/) 31 | 32 | # 支持性 33 | * Android 4.1 (API 16) 34 | * iOS 8.0+ 35 | * WebKit 534.30+ 36 | 37 | # 环境搭建 38 | ### 脚手架安装: 39 | ``` 40 | $ npm i eros-cli -g 41 | ``` 42 | 如果你在中国地区,我们还是推荐您使用 cnpm 安装脚手架 43 | ``` 44 | $ cnpm i eros-cli -g 45 | ``` 46 | 如果安装过程中报错,是因为 eros-cli 依赖了 node-sass,解决的方式有很多,可以自行搜索解决一下。 47 | 48 | ### darwin 开发 iOS: 49 | > CocoaPods 使用过程中遇到问题及时 Google 50 | 51 | * Xcode (appStore 下载) 52 | * CocoaPods(建议使用pod 1.4.0版本) 53 | * 升级 Ruby 环境:`$ sudo gem update --system` 54 | * 移除现有 Ruby 镜像:`$ gem sources --remove https://rubygems.org/` 55 | * 添加ruby-china镜像:`$ gem source -a https://gems.ruby-china.org/` 56 | * 安装 CocoaPods:`$ sudo gem install cocoapods -v 1.4.0` 57 | * 如果以上命令报错则执行:`$ sudo gem install -n /usr/local/bin cocoapods -v 1.4.0` 58 | * 最后执行:`$ pod setup 过程比较漫长,请耐心等待执行完成` 59 | 60 | ### darwin/windows/linux 开发 Android: 61 | * 下载并安装 [JDK](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)。 62 | * 下载并安装 [Android Studio](https://developer.android.google.cn/studio/index.html)。 63 | 64 | JDK 是 JAVA 开发包,AndroidStudio 是 Android开发IDE,这两项不再做过多介绍。 65 | 66 | > 如果您使用虚拟机进行跨平台开发,也需要配置好对应平台的所需环境。 67 | 68 | ### 模拟器安装 69 | * ios 开发中 xcode 已经自带了模拟器。 70 | * android 自带模拟器即可,如果享有更好的体验,可以下载 `Genymotion`。 71 | 72 | # 模板生成 73 | 1.首先通过脚手架自动生成开发模板(不推荐用sudo来执行 eros 任何命令)。 74 | ``` 75 | $ eros init 76 | ``` 77 | 按提示选择模板,填写 app/项目名称和版本后在当前路径下会生成对应模板,然后 `cd` 到项目中。 78 | ![eros-init](http://upload.ouliu.net/i/20171213130643p940k.gif) 79 | 80 | 2.下载所需依赖前端依赖(国内地区还是建议使用 cnpm): 81 | ``` 82 | $ cnpm install 83 | ``` 84 | 85 | 3.运行项目: 86 | 87 | * **iOS**
88 | `cd`到iOS工程目录`platforms/ios/WeexEros` 执行`pod update`命令来拉取iOS工程的依赖 89 | ``` 90 | $ pod update 91 | ``` 92 | 93 | 首次执行时间会稍长,命令执行完毕后找到当前目录下 `WeexEros.xcworkspace` 文件,双击即可唤起XCode打开 iOS 工程;
94 | 然后在XCode选择相应的模拟器(比如iPhone 8),点击`▶`按钮来运行项目。 95 | 96 | * **Android**
97 | 首次生成项目开发者需要多几个步骤:
98 | 1.点击AndroidStudio上方的 **File--->New--->Import Project。** 99 | 100 | ![](https://img.benmu-health.com/gitbook/1505963461481.jpg) 101 | 102 | 2.找到eros在你本地的地址,选择 **platforms/android/WeexFrameworkWrapper** ,点击**OK。** 103 | 104 | ![](https://img.benmu-health.com/gitbook/1505963624252.jpg) 105 | 106 | 3.待项目构建完成,点击 AndroidStudio 上方工具栏的 **Run** ,即可运行项目。 107 | ![](https://img.benmu-health.com/gitbook/1505963683163.jpg) 108 | 109 | 注意: 110 | > 第一次打开 AndroidStuido 时,由于本地环境未配置好,AndroidStuido 会提示错误,按照 IDE 提示,大部分环境问题都可以解决。 111 | 112 | 于是 eros 的 demo 便能在模拟器中跑起来了。 113 | 114 | ![eros-demo](https://bmfe.github.io/eros-docs/zh-cn/image/show.gif) 115 | 116 | > eros 的 demo 很重要,建议在开发中,首先跟随 demo 编写几个页面,并保留其代码作为使用参考。 117 | 118 | # 开发前 119 | 我们先来介绍 eros 开发中需要知道的点: 120 | 121 | ##### 服务包 122 | 本地开发的时候(运行脚手架 `eros dev` 指令),脚手架 `eros-cli` 会通过读取配置文件来在特定端口跑一个服务,让你在本地访问到项目中 dist 下通过 webpack 打包生成的 JS Bundle。 123 | 124 | 假如你配置的端口号是8889,在浏览器中输入`localhost: 8889/dist` 便可以看到打包生成的 JS Bundle。 125 | 126 | ##### 内置包 127 | 128 | 上面介绍了通过服务来访问 JS Bundle,那我们拔了真机拔了数据线,断了网,没了有 JS Bundle 来源,用户打开是一片空白怎么办?**答案就是 app 内置中 JS Bundle**,我们也叫这部分 JS Bundle 为`内置包`,这个过程叫`打内置包`。 129 | 130 | > 而很多开发者在这里就能猜到,我们发布正式版本 APP,用户用的就是内置包,当我们在服务器发布了新的版本,APP 去请求服务器的包替换本地的内置包,便完成了一次升级,不用再走 APP 审核发布的流程了。 131 | 132 | **相对于 weex 每次都走线上请求最新的 bundle,我们做内置包的设计是因为有如下场景:** 133 | 134 | 1.发布了新页面。 135 | 136 | - weex 场景:新的页面,不做缓存的话,因为加载远端的 bundle,首次加载会很慢。 137 | - eros 场景:客户在使用中还是访问老的页面,下次进入 app 更新访问新的,每次从本地读取 bundle,很快。 138 | 139 | 2.bundle 打包体积。 140 | 141 | - weex 场景:weex 推荐多页面,所以每个页面都是个 bundle,意味着使用时候如果不做特殊处理,按需引入,每个 bundle 会有很多重复的冗余代码,尽管 weex 相比 rn,bundle 的体积已经小很多了。 142 | - eros 场景:weex 在本地有一个公共的 js bundle (appboard),我们把公共逻辑都放入这里,每次打包都打一份代码,并把公共代码在客户端来进行拼接,虽然这样不太规范,**但这样的方式使我们的 bundle 大小减少了 60% +,100 多个页面,内置包大小仅仅为 2MB**。 143 | 144 | 3... 145 | 146 | 其实还有很多场景,内置包的设计,不难看出更贴近于 native 项目,而上面提到的服务包,也成为我们快速调试开发的利器。 147 | 148 | ##### Interceptor 拦截器 149 | 那么又有问题来了,我们如何告诉 app 是访问服务包还是内置包呢?答案是 `Interceptor` 开关。 150 | 151 | ![Interceptor](http://upload.ouliu.net/i/20171213115118q9mim.gif) 152 | 153 | * Interceptor 选中的时候,我们会拦截请求,让 app 读取内置包; 154 | * Interceptor 未选中的时候,不拦截请求,让 app 去配置的服务上去取服务包; 155 | 156 | 第一次跑起来 demo 的开发者可以看到,拦截器是开启的,访问的是内置包。 157 | 158 | ##### 项目结构 159 | 下面列出了对于开发而言关心的项目结构: 160 | ``` 161 | . 162 | ├── config 163 | │   ├── eros.dev.js // 脚手架配置文件 164 | │   └── eros.native.js // 客户端配置文件 165 | ├── platforms 166 | │   ├── android // Android 平台主项目和依赖 167 | │   └── ios // iOS 平台主项目和依赖 168 | └── src 169 | ├── assets // 本地静态资源存放,一般可存放图片 170 | ├── iconfont // 本地 iconfont 存放 171 | ├── js 172 | │   ├── components // 组件,存放了经过修改的 weex-ui 和 bui 173 | │   ├── config // 项目开发配置 174 | │   │   ├── apis.js // 接口别名配置 175 | │   │   ├── index.js 176 | │   │   ├── pages.js // 路由别名配置 177 | │   │   └── push.js // 个推事件处理 178 | │   ├── css // 可抽离公共 css 逻辑 179 | │   ├── mediator // 中介者 180 | │   ├── pages // 页面开发,所有页面都放置在这里 181 | └── mock 182 | └── test // mock 服务,在 eros.dev.js 可进行配置 183 | ``` 184 | 185 | 有个需要注意的地方: 186 | * **eros.dev.js** 中如果改变,**这时如果你在跑着 `eros dev` 服务,需要断开,让脚手架重新读取配置文件。**(开发中会经常添加新的打包入口) 187 | * **eros.native.js** 是**客户端读取的配置文件,目前是客户端在开启 app 的时候统一从内置包中读取**,所以当此文件变动的时候,也是重新运行 `eros dev`,重新运行下 app,即可生效。 188 | 189 | # Hello Eros 190 | 我们来简单开发一个 Hello World: 191 | 192 | 1.首先**关闭调试中的拦截器**,让 app 访问服务包,这时候刷新页面肯定是空白的,因为都没有服务。 193 | 194 | 2.项目根目录下运行开发服务 **`eros dev`**,运行成功之后刷新出现内置的 demo 页面,这是其实你已经可以任意修改 pages/eros-demo 中代码,刷新后看效果了,有兴趣可以到处试一试。 195 | 196 | > tips: 双击调试按钮即可刷新,如果在同一局域网内,开启了 hotRefresh,手机会连接上脚手架,保存即刷新。 197 | 198 | 3.在 pages 目录下新建一个 `Hello.vue` 文件。 199 | 200 | ![Hello.vue](http://upload.ouliu.net/i/20171213143653v844z.jpeg) 201 | 文件中写一些很简单的语法: 202 | ```js 203 | 210 | 216 | 224 | ``` 225 | 226 | 4.修改 **`eros.dev.js`** 中的 exports,如果不需要,可以把 eros-demo 中的路径都删掉,只填入新的文件入口 : 227 | 228 | ```js 229 | "exports": [ 230 | // appBoard 231 | "js/config/index.js", 232 | // mediator 233 | "js/mediator/index.vue", 234 | // home 235 | "js/pages/Hello.vue" 236 | ], 237 | ``` 238 | 239 | 这里注意上面两个是和 eros.native.js 中的 appBoard,mediator 一一对应的,如果这里两边修改没有对应上会导致报错,建议平时不用变动。 240 | 241 | 5.告诉 app 我要重新改变首页,修改 **eros.native.js** 中的 page.homePage 路径: 242 | 243 | ```js 244 | "page": { 245 | "homePage": "/pages/Hello.js", 246 | } 247 | ``` 248 | 249 | 6.**断开 `eros dev` 服务**,因为要告诉脚手架配置文件的变动。 250 | 251 | 7.重新运行(run)app。 252 | 253 | 这时首页就已经开发好了: 254 | ![首页](http://upload.ouliu.net/i/20171213151248dyqs1.jpeg) 255 | 256 | 下面我们修改做一个页面间的跳转,试一试 Widget: 257 | 258 | 8.再在 `pages `目录下新建一个页面 **`Eros.vue`** 259 | ```js 260 | 266 | 270 | 275 | ``` 276 | 277 | 9.修改 **`eros.dev.js`** 告诉脚手架添加页面了: 278 | 279 | ```js 280 | "exports": [ 281 | // appBoard 282 | "js/config/index.js", 283 | // mediator 284 | "js/mediator/index.vue", 285 | // home 286 | "js/pages/Hello.vue", 287 | // eros 288 | "js/pages/Eros.vue" 289 | ], 290 | ``` 291 | 292 | 10.注册路由,修改 **`js/config/routes.js`**,清空 demo 中现有的配置: 293 | 294 | ```js 295 | export default { 296 | 'Eros': { 297 | title: 'Eros', 298 | url: '/pages/Eros.js', 299 | }, 300 | } 301 | ``` 302 | 这里的 url 是填写 dist 目录中打包出来 JS Bundle 的相对路径(现在并没有这个 JS Bundle,需要重启开发服务读取配置才会有),注意因为是 JS Bundle 所以以 .js 为结尾。 303 | 304 | 11.重启 eros dev,刷新一下,并无任何变化,这时候还无法跳转到新建的页面,因为只是配置了路由,并未触发跳转方法,我们需要修改下 305 | 306 | **`Hello.vue`**: 307 | ```js 308 | 315 | 329 | 337 | ``` 338 | 339 | 12.双击调试按钮刷新(开启热更新会自动刷新),跳转逻辑已经完成了! 340 | 341 | ![router](http://upload.ouliu.net/i/20171213154813lms38.gif) 342 | 343 | 至此 Hello world 已经编写完成,可以便根据文档来编写你的业务了。 344 | 345 | # 内置包更新 346 | 很多时候,我们需要把我们编写的 JS bundle,更新到对应 native 的代码中,可以打开拦截器,断开数据线给其他人使用或者演示: 347 | ``` 348 | $ eros pack 349 | ``` 350 | 选择对应平台即可,也提供了 `eros pack ios`, `eros pack android`, `eros pack all` 三个指令快捷操作。 351 | 352 | # demo 353 | 354 | eros 还有 demo 是根据网易严选 demo 进行改编的(感谢 [zwwill](https://github.com/zwwill) 的开源和指导),开发者也可以进行参考: 355 | 356 | * [eros 网易严选 demo](https://github.com/bmfe/eros-yanxuan-demo-v2) 357 | 358 | 最后开发者需要自行修改原生项目中的一些信息,就可以发 app 正式版本,对外使用了,发布的方法网上有很多介绍,就不过多赘述。 359 | 360 | # 增量发布 361 | 具体更新逻辑可以[点击这里](https://github.com/bmfe/eros-template/wiki/%E5%8F%91%E5%B8%83%E6%9B%B4%E6%96%B0),这里写下简单的说明。 362 | 363 | app 发布有两种情况: 364 | * 当 platforms ios/android 目录下的代码发生变动的时候,我们是需要重新发布到市场上重新走审核逻辑的,用户需要重新去市场上面下载。 365 | * 而当项目中的业务逻辑发生变动,如新增页面,修改当前页面逻辑等,最终导致 JS Bundle 发生变化,便可以使用增量发布,每次 app 启动会自动检测更新,下载 JS Bundle 中发生变动的部分,用户重启即生效。 366 | 367 | 同时 eros-cli 也支持生成全量包和生成增量包: 368 | 369 | 生成全量包: 370 | ``` 371 | $ eros build 372 | ``` 373 | 生成增量包: 374 | ``` 375 | $ eros build -d 376 | ``` 377 | 378 | 后续会详细介绍增量发布的逻辑。 379 | -------------------------------------------------------------------------------- /zh-cn/update_log_android.md: -------------------------------------------------------------------------------- 1 | # 2.1.1 2 | 1. 修复未获得权限时多次点击图片可能出现返回多张图片问题。 3 | 2. 添加权限申请。 4 | 3. 将调试修改成扫一扫,并升级weex debug. 5 | 4. 修复一些已知bug 6 | 5. bmchart支持传递方法 7 | 8 | # 2.1.0 9 | 1. 拓展weex.config.eros变量 10 | 2. 修复ToolsMoudle 是否安装微信方法 11 | 3. 修复iconfont不显示问题。 12 | 4. 修改富文本默认字体 13 | 5. 修复一些已知bug 14 | 6. 修复bmCalendar样式不生效问题 15 | 7. 修复滑动事件影响bmRefresh消失问题 16 | 17 | # 2.0.9 18 | 1. 动态修改activity category 无需在启动activity时进行选择 19 | 2. 修复debug invalidate instance报错 20 | 3. 集成weex性能分析(摇一摇开启) 21 | 4. 修改setHomePage 返回无效问题 22 | 5. 修改上传图片返回字符串改为对象 23 | 24 | 25 | # 2.0.8 26 | 1. 修复axios bug 27 | 2. 修复setHomePage方法没有立即生效问题。 28 | 3. 修复sms 发短信崩溃问题。 29 | 4. 修复调试按钮点击崩溃问题。 30 | 5. 修复call方法总是110问题。 31 | 6. 修复预览本地图片问题。 32 | 7. 修改返回格式status问题 33 | 34 | # 2.0.7 35 | 1. 添加一键调试,不需要扫一扫即可调用调试,模拟器现在也可以调试了;需要在 `eros.native.js` 中添加 `debugServer`,添加方式请看[eros.native.js 配置教程](https://github.com/bmfe/eros-template/wiki/%E9%85%8D%E7%BD%AE%E7%9B%B8%E5%85%B3); 36 | 2. 新增[bmImage](https://github.com/bmfe/eros-template/wiki/bmImage) Module,将图片相关方法统一放到此Module中,bmCamera及bmBrowserImg Module已经废弃,后续版本中移除; 37 | 3. [bmAxios](https://github.com/bmfe/eros-template/wiki/bmAxios) Module 新增 uploadImage 方法,用于上传本地图片; 38 | 4. 扫一扫功能移植到了[bmTool](https://github.com/bmfe/eros-template/wiki/bmTool) Module 中; 39 | 5. 预览图片 preview 方法支持浏览本地图片及 jsbundle 中的图片; 40 | 6. 优化加载中介者机制,当拦截器变化时重新加载,刷新页面的时候检查是否已经加载成功; 41 | 7. 新增bmWebsocket Module; 42 | 8. bmRouter Module 新增 setHomePage方法: 作用:重新设置app启动加载的首页,js传path过来,native端会将传过来的path存储到本地,app启动的时候优先读取这个参数来显示首页,没有的话读取 native.js 中的配置; 43 | 9. navigatorModule支持RGB设置字体颜色 44 | 45 | # 2.0.6 46 | 1. 统一支持库的依赖版本 47 | 2. config.eros 中加入jsVersion deviceId navBarHeight 环境参数 48 | 3. bmRouter增加openBrowser方法以打开浏览器 49 | 4. 升级WeexSDK到0.17.0 50 | 5. eros.native.json加密 51 | 6. 上传图片module中传入url地址 52 | 7. axios 统一返回格式 53 | 8. bmStorage 去掉外面包装层 54 | 9. 打开通讯录选择联系人电话号码和打开短信发送信息 55 | 10. 所有除了崩溃的报错都弹窗提示 56 | 11. 双击调试按钮刷新 57 | 12. 解决手势冲突(sider 和 scroller相互嵌套) 58 | 59 | # 2.0.5 60 | 1. 图片上传增加传递head 参数 默认为null 61 | 2. 修改loading 实现,并做了微小修改 62 | 63 | # 2.0.4 64 | 1. 修改 EventFetch patch 方法 65 | 2. 修改 pages.zip 改成 bundle.zip 66 | 67 | # 2.0.3 68 | 1. 增加第一个页面的 物理返回按钮监听抛出事件'homeBack' 69 | 2. 增加 finish 方法 给前端调用。 70 | 3. eros.native.json 增加配置 isListentHomeBack 等于1时 监听HomeBack 71 | 72 | # 2.0.2 73 | 1. 修改 AbstractWeexActivity 基类,删除 基类里返回和销毁 时检查是否开启dialog代码。 74 | 2. 修改 bmRouter callPhone方法,增加 int型 nowCall参数,如果传递并且 等于1时 不弹出dialog 直接跳转拨打电话页面 75 | 76 | 77 | # 2.0.1 78 | 1. 更新编译gradle版本 79 | 2. 打开jsbundle更新逻辑 80 | 3. 修复上传问题 上传图片可附带参数 81 | 4. 支持BMChart 82 | 5. 集成weex-amap 83 | 6. 增加bmAuth moudle 支持微信授权登陆 84 | 85 | # 2.0.0 86 | 1. 目录调整 87 | 2. 集成了个推推送 88 | 3. 集成日历控件 89 | 5. iconfont加载逻辑优化 90 | 6. 集成bmGeo模块 91 | 92 | 93 | -------------------------------------------------------------------------------- /zh-cn/update_log_cli.md: -------------------------------------------------------------------------------- 1 | # 脚手架更新方法 2 | ``` 3 | $ npm i eros-cli -g 4 | ``` 5 | 6 | # 更新日志 7 | ## 2.0.4 8 | * fix: eros pack all 失效问题 9 | * fix: eros pack ios 失效问题 10 | * fix: eros pack android 失效问题 11 | 12 | ## 2.0.3 13 | * add: eros pack all 14 | * add: eros pack ios 15 | * add: eros pack android 16 | 17 | ## 2.0.2 18 | * add: eros install ios 19 | * add: eros install android 20 | * add: eros update ios 21 | * add: eros update android 22 | * add: eros update template your_path 23 | * add: eros update widget 24 | 25 | ## 2.0.1 26 | * fix: eros build 会打内置包的情况 27 | * add: eros pack --all 同时打两端的内置包 28 | 29 | ## 2.0.0-beta.14-16 30 | * 添加 eslint 编译 31 | 32 | ## 2.0.0-beta.13 33 | * 修复 windows 上报打包含有 weex-ui 组件的页面,解析错误的bug 34 | 35 | ## 2.0.0-beta.10 - 12 36 | * eros pack 没有打包本地静态资源 37 | 38 | ## 2.0.0-beta.9 39 | * fix 脚手架 dev 报错的问题 40 | 41 | ## 2.0.0-beta.8 42 | * 删除组件更新 43 | 44 | ## 2.0.0-beta.7 45 | * bugfix: 修复 eros init 报错的问题 46 | 47 | ## 2.0.0-beta.6 48 | date: 2017-12-29 49 | * 脚手架更新: 加密算法 50 | * 脚手架更新: 添加tree-shaking 51 | * 脚手架更新: 精简体积,删除无用代码 52 | * 脚手架更新: eros update 可选择不再覆盖 53 | 54 | 55 | ## 2.0.0-beta.5 56 | * pack 动态给安卓添加配置信息。 57 | 58 | ## 2.0.0-beta.4 59 | * 优化差分包逻辑,增加webpack输出提示。 60 | 61 | ## 2.0.0-beta.2 62 | * 新增eros update 63 | 64 | ## 2.0.0-beta.1 65 | * 新增 eros init 66 | * 新增 eros build 67 | * 新增 eros dev 68 | * 新增 eros pack (--ios/android) 69 | * 新增 eros install (--ios/android) 70 | * 兼容windows 71 | * minWeex 打包问题 72 | * 打包js的时候 混淆会顺便删除map文件减少体积 73 | * iconfont 打包路径问题 74 | * 修改 eros NODE_env 搭配修复eros debug问题 75 | * 支持stylus 76 | * fix diff bug 77 | * build assets 时候多调用了打 iconfont md5 方法 78 | -------------------------------------------------------------------------------- /zh-cn/update_log_ios.md: -------------------------------------------------------------------------------- 1 | ## 1.1.4 (2018.1.31) 2 | 更新操作:执行`eros install --ios` 3 | 1. 适配 weex debug 1.0.0版本,改回扫一扫调试; 4 | 2. 修复调用toast message 传num时崩溃的问题; 5 | 3. 优化bmchat图标组件,支持调用方法; 6 | 7 | ## 1.1.3 (2018.1.24) 8 | 更新操作:执行`eros install --ios` 9 | 1. 修改bmRouter getParams 没有数据的时候返回空字符串; 10 | 2. 优化bmRichtText,有一定几率不显示的问题; 11 | 12 | ## 1.1.2 (2018.1.17) 13 | 更新操作:执行 `eros install --ios` 14 | 1. 优化上传图片的数据返回格式; 15 | 2. 优化设置导航栏按钮方法,修复按钮大小显示不一致的问题,并以文档说明; 16 | 17 | ## 1.1.1 (2018.1.5) 18 | 此版本升级需要更新工程文件:`install.sh,Podfile`,参考wiki iOS更新依赖中的[升级工程文件](https://github.com/bmfe/eros-template/wiki/iOS-%E6%9B%B4%E6%96%B0%E4%BE%9D%E8%B5%96%E7%9B%B8%E5%85%B3) 19 | 1. 添加一键调试,不需要扫一扫即可调用调试,模拟器现在也可以调试了;需要在 `eros.native.js` 中添加 `debugServer`,添加方式请看[eros.native.js 配置教程](https://github.com/bmfe/eros-template/wiki/%E9%85%8D%E7%BD%AE%E7%9B%B8%E5%85%B3); 20 | 2. 新增[bmImage](https://github.com/bmfe/eros-template/wiki/bmImage) Module,将图片相关方法统一放到此Module中,bmCamera及bmBrowserImg Module已经废弃,后续版本中移除; 21 | 3. [bmAxios](https://github.com/bmfe/eros-template/wiki/bmAxios) Module 新增 uploadImage 方法,用于上传本地图片; 22 | 4. 扫一扫功能移植到了[bmTool](https://github.com/bmfe/eros-template/wiki/bmTool) Module 中; 23 | 5. 预览图片 preview 方法支持浏览本地图片及 jsbundle 中的图片; 24 | 6. 优化了bmchat组件,通过修改html代码确定内容高度===bmchat组件设置的高度;(感谢:阳光只要七十米) 25 | 26 | ## 1.1.0 (2017.12.29) 27 | 此版本升级需要更新工程文件:`install.sh、podFile`,参考wiki iOS更新依赖中的[升级工程文件](https://github.com/bmfe/eros-template/wiki/iOS-%E6%9B%B4%E6%96%B0%E4%BE%9D%E8%B5%96%E7%9B%B8%E5%85%B3) 28 | 1. 升级WeexSDK(0.17.0)[weex更新说明](https://weex.incubator.apache.org/cn/releasenote.html); 29 | 2. [config.eros](https://github.com/bmfe/eros-template/wiki/%E5%85%A8%E5%B1%80%E5%B1%9E%E6%80%A7)中添加statusBarHeight、navBarHeight、touchBarHeight、jsVersion参数; 30 | 3. [bmCamera](https://github.com/bmfe/eros-template/wiki/bmCamera) Module updateImage 方法支持自定义request header; 31 | 4. 优化[bmAxios](https://github.com/bmfe/eros-template/wiki/bmAxios)、[bmStorage](https://github.com/bmfe/eros-template/wiki/bmStorage) Module 的回调数据格式; 32 | 5.[bmRouter](https://github.com/bmfe/eros-template/wiki/bmRouter) Module新增openBrowser方法,使用系统浏览器打开url; 33 | 6. eros.native.js 加密处理; 34 | 7. 新增[bmCommunication](https://github.com/bmfe/eros-template/wiki/bmCommunication)Module,添加打开通讯录选择联系人方法、打开短信发送信息方法、将打电话方法移植到这里; 35 | 8. 升级WeexDevTool:js报错会弹窗提示错误日志 (点击状态栏的 mnt 可以查看更多详细内容); 36 | 9. 优化加载中介者机制,当拦截器变化时重新加载,刷新页面的时候检查是否已经加载成功; 37 | 11. 新增bmWebsocket Module; 38 | 12. bmRouter Module 新增 setHomePage方法: 作用:重新设置app启动加载的首页,js传path过来,native端会将传过来的path存储到本地,app启动的时候优先读取这个参数来显示首页,没有的话读取 native.js 中的配置; 39 | 40 | ## 1.0.1 41 | 1.bmCanera Module updateImage 方法支持自定义url; -------------------------------------------------------------------------------- /zh-cn/update_log_template.md: -------------------------------------------------------------------------------- 1 | ## 模板更新方法 2 | ``` 3 | $ eros update template your_want_update_path 4 | ``` 5 | > `your_want_update_path` 是你想要覆盖的路径,可以是文件可以是文件夹,请谨慎使用,如果您里面文件夹已经做修改还是建议您先提交或者直接参考 github 上的模板代码进行修改。 6 | 7 | 8 | ## 2018-02-01 9 | * add scripts/ios.install.sh 10 | * add scripts/android.install.sh 11 | * add scripts/ios.update.sh 12 | * add scripts/android.install.sh 13 | 14 | ## 2018-01-24 15 | * 全新的 demo 16 | * fix widget 中 storage 返回格式不统一的问题 17 | * fix widget 中 this.$image.upload 参数问题 18 | 19 | ## 2018-01-05 20 | widget拓展 : 21 | * $tools.scan 扫一扫 22 | 23 | * $image.camera 照相返回图片地址 24 | * $image.pick 选择本地图片 返回本地图片地址 (可直接在 image 标签 src 中使用) 25 | * $image.preview 预览图片 可预览本地和线上图片 26 | * $image.upload 上传图片 27 | * $image.pickAndUpload 选取本地图片并上传 28 | 29 | * $router.openBrowser 用内置浏览器打开一个网址 30 | 31 | * $coms.call 打电话 32 | * $coms.sms 发消息 33 | * $coms.contacts 打开联系人页面 34 | 35 | > 重要修改:原 $image.upload 修改为 $image.pickAndUpload 选取本地图片并上传 36 | 37 | 38 | ## 2017-12-29 39 | * 模板更新: widget 更新优化 40 | * 模板更新: 移除__eros__文件夹 不再需要 41 | * 模板更新: 支持 npm install weex-ui 来使用 42 | 43 | ## 2017-12-20 44 | widget 中对应添加 camera module 上传图片自定义 url 的字段。 45 | --------------------------------------------------------------------------------