This article series: vue2.0 together in the sea of meng forced deeper (http://leenty.com/tags/vuejs/)
In October of this year, Vue2.0 will be released. Let’s sink in the ocean!
I haven’t sent any essays recently. On the one hand, I have to prepare for an exam; on the other hand, I am studying vue2.0; on the other hand, I don’t know what to write. (In fact, the biggest aspect is that he found a lazy reason not to write essays…)
Zhou Xingxing and the other three talented people in the South of the Yangtze River have a famous saying: A flock of geese at the foot of the mountain, catcalling into the river. Under the river to catch a goose belly hungry, eat home to play… Uh… Play vue2.0 cough cough cough cough
Let’s see what vue2.0 has to offer
- Virtual-dom (supposedly not normal Virtual-dom)
- Templates | | JSX | | Hyperscript (now, you can choose your favorite write model developed)
- Streaming server rendering (this sounds awesome, but we’ll look into it later)
- Other (various performance optimizations, more room for imagination, more possibilities)
With the vUE 2.0 update, other components of the VUE ecosystem have also been updated
- vue-router
- vue-resource
- vue-cli
All right, let’s get down to business
Put an address first, My Vue2.0 demo uses vuE-CLI to quickly generate and release environment. Vue-router is added for front-end routing, vue-Resource is added for Ajax, and VUex is added for state management. Currently, the Demo uses hash mode, which will be introduced one by one next
Specific details
Ok, now turn on your terminal and start driving! 🚌
-
Install the vue – cli
npm install -g vue-cliCopy the code
-
Create vUE project syntax:
vue init <template-name> <project-name>Copy the code
Here I have chosen to use Webpack (see Git Entry level – Creating a project on Github).
vue init webpack appCopy the code
Vue-cli will then ask for the Project name. You can either type your Project name or press Enter to use the previous name by default
And then there’s a series of questions, and you can go all the way back, and you’ve created one
It’s going to look something like this
- Install dependencies
npm iCopy the code
When this step is complete, you can use the command to start the VUE application
npm run devCopy the code
- Next, install the other required components, vuE-Router, VUE-Resource, and VUex
npm install vue-router vue-resource vuex --saveCopy the code
At this point, the skeleton of the VUE project is in place.