weex入门第一课

阅读数:1226 发布时间:2016-06-22 11:19:11

作者:gsh 标签: weex

第一步:

在命令行输入如下指令,安装Weex的CLI工具

npm install -g weex-toolkit

第二步:

安装完成后,在命令行内直接输入:

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"]

第三步:

新建一个文件,名叫:test.we 把下面的内容贴进去,保存。

<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>

第四步: 在命令行执行下面的命令,就可以看到内容啦

weex test.we

相关文章推荐: