Using dotWe is a good choice, but if you want to develop locally on your own machine, you will need to set up your development environment.
You will need Node.js and the Weex CLI.
You can install Node using nvm (Simple bash script to manage multiple active node.js versions). Run the following commands in a Terminal after installing nvm:
Node.js comes with npm, which lets you install the Weex CLI.
Run the following command in a Terminal:
NOTE: If you get an error like “permission error”, try installing with
Then you can use the Weex command to verify that the installation is successful:
You can use the CLI to generate a Weex project called “awesome-project”. Run the following command in a Terminal:
Then enter the awesome-project folder, the CLI has been for us to generate a standard project structure.
We enter the awesome-project folder and install dependencies with the following commands:
Then we run
npm run dev & npm run serve in root directory to start watch mode and static server.
Finally, we can see the Weex page in
You can modify this page in
src/foo.vue. The code is shown below:
If you’re curious to learn more about technical details, continue on to the next section. And don’t forget to write code at dotWe and preview at anytime.