Study notes to write the first program of Vue

Study notes to write the first program of Vue

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 data

View

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

  • if
  • for

event

  • on

787 Principle

To learn Vue, we must know its 7 properties, 8 methods, and 7 instructions

el attribute

It is used to instruct the Vue compiler where to start parsing the Vue syntax, which can be said to be a placeholder.

data attribute

It 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 attribute

Used to set the template, which will replace page elements, including placeholders.

Methods Attribute

Place the business logic in the page. JS methods are generally placed in methods.

Render Properties

Creating a real Virtual Dom

computed properties

Used to calculate

watch property

watch: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:
  • Learn the key knowledge that must be mastered in the Vue framework
  • In-depth study of the usage and principles of Vue nextTick
  • Learn Vue component examples
  • Learn Vue.js conditional rendering
  • Learn Vue.js calculated properties
  • Simple learning vue directive

<<:  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

Recommend

Tutorial diagram of installing centos7.3 on vmware virtual machine

VMware Preparation CentOS preparation, here is Ce...

Summary of solutions to common Linux problems

1. Connect Centos7 under VMware and set a fixed I...

How to use Zen coding in Dreamweaver

After I published my last article “Zen Coding: A Q...

In-depth explanation of currying of JS functions

Table of contents 1. Supplementary knowledge poin...

How to use @media in mobile adaptive styles

General mobile phone style: @media all and (orien...

Drop-down menu and sliding menu design examples

I found a lot of websites that use drop-down or sl...

How to create a responsive column chart using CSS Grid layout

I have been playing around with charts for a whil...

WeChat applet implements simple calculator function

WeChat applet: Simple calculator, for your refere...

Sample code for implementing two-way authentication with Nginx+SSL

First create a directory cd /etc/nginx mkdir ssl ...

In-depth understanding of the use of r2dbc in MySQL

Introduction MySQL should be a very common databa...

HTML fixed title column, title header table specific implementation code

Copy code The code is as follows: <!DOCTYPE ht...