VUE framework and vue framework

Source: Internet
Author: User

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

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.