First, the context dependent structures:
Add Mirror
# After installing node.js, use Taobao mirror npm install -g CNPM --registry = HTTPS: // registry.npm.taobao.org
Project Initialization
# Global installation vue- cli CNPM vue install the -cli - G # view the installation vue - cli success vue List # selected a new path to project the Hello - vue vue the init WebPACK " the Hello-vue " # install the relevant vue rely CNPM install # run cnpm run dev
A, common commands:
Vue is the MVVM (the Model / View / the ViewModel) of the front-end frame
- v-model used for two-way data binding form elements (ng-model in the same angular)
- v-for format: v-for = "field name in (of) an array of json" loop array or json (ng-repeat in the same angular), note that from the beginning canceled the $ index vue2
- v-show display content (ng-show in the same angular)
- v-hide the hidden content (ng-hide in the same angular)
- v-if show and hide (delete dom elements with angular add ng-if the default is false)
- v-else-if necessary, and v-if used in conjunction
- v-else must be used in conjunction with v-if you can not use otherwise an error template compilation errors alone
- v-bind dynamic binding effect: timely data page changes
- v-on: click to label binding function, may be abbreviated as @, for example, bind a click function function must be written in methods inside
- v-text parse text
- v-html parsing html tags
- v-bind: class three kinds of binding process, the object type '{red: isred}' 2 , three-way type '? isred "red": " blue"' 3, the array type '[{red: "isred" } , {blue: "isblue"} ] '
- v-once only rendered when entering a page is not rendered
- v-cloak preventing flicker
- v-pre put inside the tag output element situ