加载中...

1.3.1 浏览器中预览weex代码


weex-toolkit

我们强烈建议你使用weex-toolkit在浏览器中预览weex代码。这个工具基于NodeJS,所以你需要先安装Node。请从https://nodejs.org/en/download/stable/网站下载安装最新稳定版本的Node。
接下来你就可以通过npm安装weex-toolkit

  1. npm install -g weex-toolkit

通过在终端中输入weex检查是否可以运行,通常你应该看到如下的帮助文字:

  1. Options:
  2. --qr display QR code for native runtime,
  3. -o,--output transform weex we file to JS Bundle, output path (single JS bundle file or dir)
  4. -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
  5. ......
  6. --help Show help

假如一切运行正常,终端导航到你想预览的xxx.we所在目录,输入命令:

  1. weex xxx.we

浏览器窗口将会自动打开显示你想预览的页面:
preview page


还没有评论.