Here we use the official document CDN <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script> 1. Write an HTML, the first Vue program<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <!--view layer template--> <div id="app"> {{message}} </div> <!--Import vue.js--> <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script> <script> var vm = new Vue({ el:"#app", //model: data:{ message:"hello,vue" } }); </script> </body> </html> Note the view template and dataView Model ViewModel: Two-way binding means that if your front-end data changes, the data in your data will also change. You can change the data without refreshing the page and then synchronize it to the front-end display Decision loop
event
787 PrincipleTo learn Vue, we must know its 7 properties, 8 methods, and 7 instructions el attributeIt is used to instruct the Vue compiler where to start parsing the Vue syntax, which can be said to be a placeholder. data attributeIt is used to organize the attributes abstracted from the view. It can be said that the view data is abstracted and stored in the data. template attributeUsed to set the template, which will replace page elements, including placeholders. Methods AttributePlace the business logic in the page. JS methods are generally placed in methods. Render PropertiesCreating a real Virtual Dom computed propertiesUsed to calculate watch propertywatch:function(new,old){} Monitor changes in data Two parameters, one returns the new value, one returns the old value The above is the detailed content of the first program of the study note vue. For more information about vue programs, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: Which is faster among MySQL full-text index, joint index, like query, and json query?
>>: Installation steps of Ubuntu 20.04 double pinyin input method
Table of contents 1. React Basic Usage Notable Fe...
Table of contents 1. Self-enumerable properties 2...
This article shares the MySQL precompilation func...
Copy code The code is as follows: <hr style=&q...
1. Introduction Earlier we talked about the front...
This article shares the specific code of JavaScri...
The domestic market still has a certain demand fo...
Note: This method is only applicable to webkit-ba...
background On mobile devices, caching between pag...
Recently, I encountered many problems when deploy...
As an entry-level Linux user, I have used simple ...
question When I was writing a project function to...
Passive Check With passive health checks, NGINX a...
1. The catalina.bat must be set to UTF-8. If I do...
Preface This article mainly explains how to imple...