weex初探

  1. 执行命令安装
npm install weex-toolkit -g
1

过程给出了一个错误:MSBUILD : error MSB4132: 无法识别工具版本“2.0”。可用的工具版本为 "14.0", "4.0"。

解决方案:

  • 1.管理员权限的Windows PowerShell或CMD,执行npm install --global --production windows-build-tools
  • 2.如果没有手动安装过Python则在上面一步自动安装Python后可能需要手动配置一下环境变量,Windows PowerShell或CMD中执行npm config set python python2.7
  • 3.重新设置该项目的msvs版本,同样Windows PowerShell或CMD中执行npm config set msvs_version 2015,或者全局的话加个-g,比如(npm config set msvs_version 2015 -g) 然后再重新安装就不会出现刚才的那个错误了

网络超时,请求在客户单根本没有被发出,默认超时设置ios很短,android是3秒,在网络比较差的情况下,很容易超时的,所以需要设置默认的超时设置timeout:20s等等

http://tech.dianwoda.com/2017/12/25/weexshi-yong-guo-cheng-zhong-de-na-xie-keng/
https://www.cnblogs.com/sunjianfei/p/7298950.html
1
2

网易严选weex demo

weex学习

weex插件

weex ui库

weex从.we转.vue之BroadcastChannel

weex加载本地图片

https://www.cnblogs.com/xiaoqi/p/weex-hackernews-code-part1.html

weex 一个传说级巨坑-- 2018最新版weex踩坑指南(weex navigator 多界面跳转)

对应三端跳转方式

getJumpBaseUrl(toUrl) {
 
        var bundleUrl = weex.config.bundleUrl;
 
        var isnav = true
        bundleUrl = new String(bundleUrl);
        var nativeBase;
        var native;
        var isAndroidAssets = bundleUrl.indexOf('file://assets/') >= 0;
        var isiOSAssets = bundleUrl.indexOf('file:///') >= 0 && bundleUrl.indexOf('WeexDemo.app') > 0;
        if (isAndroidAssets) {
            nativeBase = "local://" + 'file://assets/dist/';
            native = nativeBase + toUrl + ".js";
        } else if (isiOSAssets) {
            nativeBase = bundleUrl.substring(0, bundleUrl.lastIndexOf('/') + 1);
            native = nativeBase + toUrl + ".js";
        } else {
            var host = 'localhost:8081';
            var matches = /\/\/([^\/]+?)\//.exec(bundleUrl);
            if (matches && matches.length >= 2) {
                host = matches[1];
            }
 
            //此处需注意一下,tabbar 用的直接是jsbundle 的路径,但是navigator是直接跳转到新页面上的.
            if (typeof window === 'object') {
                nativeBase = 'http://' + host + '/';
            } else {
                nativeBase = 'http://' + host + '/';
            }
 
            native = nativeBase + toUrl + ".html";
        }
        return native;
    }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

weex&ReactNative对比