const vm = new Vue(options)

Name the instance of Vue vm

The VM object encapsulates all operations on the view, including data reads and writes, time binding, and DOM updates

The constructor of a VM is Vue, and the class to which the VM belongs is Vue

Optioins are parameters to new Vue, commonly referred to as options or construct options

What is in options

1. El – Mount point

El: Element node mounted by the Vue instance. The value can be a CSS selector, an actual HTML element, or a function that returns an HTML element.

You can also use $mount instead

2. Data – Internal data

Support for objects and functions, preference for functions is buggy

(3) Methods

Event handlers, or normal functions, must be written to methods or an error will be reported

4. The Conponents Vue component is case-sensitive

Imprt Demo from'./ demo. vue' const vm = new vue ({components:{Demo: Components :{Demo} components:{Demo}Copy the code

hook

5.1 Created – Instances appear in memory

Created (){debugger (break point proof) console.log(' this thing appears in memory, not in page ')}Copy the code

5.2 Mounted – An instance is displayed on the page

Mounted (){console.log(' it appears in the page ')}Copy the code

5.3 Updated – The instance is updated

Trigger the current function to ensure that I have updated the data

Updated (){console.log(' updated ')}Copy the code

5.4 Destroyed – The instance disappears from the page and memory

Please implement this method

6 props – External data also called properties

Message = “n” pass string

:message = “n” passes this.n data

:fn = “add” passes this. Add function