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
VMware Preparation CentOS preparation, here is Ce...
1. Connect Centos7 under VMware and set a fixed I...
After I published my last article “Zen Coding: A Q...
Table of contents 1. Supplementary knowledge poin...
When the software package does not exist, it may ...
General mobile phone style: @media all and (orien...
Solution to the problem of automatic disconnectio...
Situation description: The database was started a...
I found a lot of websites that use drop-down or sl...
I have been playing around with charts for a whil...
WeChat applet: Simple calculator, for your refere...
First create a directory cd /etc/nginx mkdir ssl ...
This article mainly introduces the method of CSS ...
Introduction MySQL should be a very common databa...
Copy code The code is as follows: <!DOCTYPE ht...