VUE framework and vue framework
1. What is vue?
It is a JAVASCRITPO framework for building user interfaces.
Ii. How to Use VUE
(1) Introduce vue. js example: <script src = 'vue. js'> <script> (2). display html such: <div id = "app"> <input type = "text v-model =" msg "> <p >{{ msg} </p> </div> (3) create a vue object new Vue ({el: "# app", // indicates that VUE data {msg: ""} is used in the current element :""}})
3. insert values into elements
{{}}, A square expression
Command, which is a special attribute with a v-prefix. It is used to operate elements.
V-text: insert the value v-html into the element: not only can insert text, but also can insert tags, v-if: dynamically insert and remove ELEMENTS v-show based on the true and false expressions: Hide and display elements v-if and v-show based on the true and false expressions: When v-if is changed to false, it does not exist in the dom. It is replaced by comments, and v-show is changed to false. It exists in the dom, but the hidden attribute v-for is added in v-showzhong: loop rendering element v-on based on the value of the variable: Listen to the element event and perform the operations you want to perform on the array: pushpopshiftunshiftsplicereversev-bind: bind the element property to perform the corresponding operation v-bind can be: replace v-on can be replaced by @ v-model: implement two-way binding of data and views. Bind the v-model file in three steps: 1. bind the element value to the Data. 2. When the input content is used, the data synchronization changes, view ---- data driver 3. when data is changed, the input content changes. Data ----- view driver custom command: new Vue ({el: "# app ", // indicates that VUE data :{}, directives: {focus: {// command name is used in the current element. // when the bound element is displayed, inserted: function (tt) {tt. focus ();}}}
<!DOCTYPE html>Index
<! DOCTYPE html> Tap Switching
<! DOCTYPE html> V-
<!DOCTYPE html>V-html
<! DOCTYPE html> V-if_show
<! DOCTYPE html> V-model
<! DOCTYPE html> V-on_bind
<! DOCTYPE html> Dynamic url generation
<!DOCTYPE html>Custom commands