1.開發(fā)環(huán)境安裝
(1)安裝Node
下載地址戳這里
(2)安裝Weex Toolkit
檢測npm版本
$ npm --version
如果低于 2.15.1就執(zhí)行(如果npm的instasll指定提示err,就在前面加上sudo偷线,下面也類似)
$ npm install -g npm
安裝node-gyp
先檢測版本
$ node-gyp --version
如果在你的系統(tǒng)中的版本低于3.4.0波材,或者提示未安裝,執(zhí)行如下:
$ npm install -g node-gyp
安裝Weex Toolkit
$ npm install -g weex-toolkit
(3)執(zhí)行$ weex 檢測是否安裝成功沥潭。安裝成功的提示信息如下
Usage: weex foo/bar/your_next_best_weex_script_file.we [options]
Options:
--qr display QR code for native runtime,
-o,--output transform weex we file to JS Bundle, output path (single JS bundle file or dir)
-s,--server start a http file server, weex .we file will be transforme to JS bundle on the server , specify local root path using the option
......
--help Show help
-h, --host [default: "127.0.0.1"]
2 hello world
創(chuàng)建目錄,在目錄中創(chuàng)建文件 tech_list.we 嬉挡,在文件中輸入如下內(nèi)容
<template>
<div class="container">
<div class="cell">
<image class="thumb" src="http://t.cn/RGE3AJt"></image>
<text class="title">JavaScript</text>
</div>
</div>
</template>
<style>
.cell { margin-top: 10; margin-left: 10; flex-direction: row; }
.thumb { width: 200; height: 200; }
.title { text-align: center; flex: 1; color: grey; font-size: 50; }
</style>
然后進入目錄執(zhí)行
$ weex tech_list.we
然后你會在瀏覽器看到如下內(nèi)容钝鸽。
hello.png