The following case reviews the knowledge points of the prototype chain we learned before // Define a constructor function Demo() { this.a = 1 this.b = 2 } //Create a Demo instance object const d = new Demo() console.log(Demo.prototype); //Display prototype properties console.log(d.__proto__); //Implicit prototype properties console.log(Demo.prototype === d.__proto__); //true //The programmer operates the prototype object by displaying the prototype attributes and appending an x attribute with a value of 99 Demo.prototype.x = 99 console.log('@',d.__proto__.x); Analyze VueComponent according to the following component <body> <div id="root"> <school></school> </div> <script> Vue.config.productionTip = false //Define the school component const school = Vue.extend({ name: 'school', template: ` <div> <h2>School name: {{name}}</h2> <h2>School address: {{address}}</h2> </div> `, data() { return { name: 'Shang Silicon Valley', address: 'Beijing' } } }) //Create Vue new Vue({ el:'#root', components:{ school, } }) </script> </body> 1. The school component is essentially a constructor called 2. We only need to write <school/> or <school</school>, and Vue will help us create an instance object of the school component when parsing; that is, Vue helps us execute: 3. Special note: Every time 4. About this pointing:
5. VueComponent instance object, hereinafter referred to as vc ---- component instance object Key Points
SummarizeThis article ends here. I hope it can be helpful to you. I also hope you can pay more attention to more content on 123WORDPRESS.COM! You may also be interested in:
|
<<: Interaction in web design: A brief discussion on paging issues
>>: A brief discussion on the difference between MYSQL primary key constraint and unique constraint
When you feel that there is a problem with MySQL ...
Why do we need virtual dom? Virtual DOM is design...
Table of contents 1. Import files 2. HTML page 3....
Table of contents Preface The value of front-end ...
Table of contents Project Background start Create...
This article is from Tom Ewer's Managewp blog,...
Starting from Elasticsearch 6.8, free users are a...
Disadvantages of single-node database Large-scale...
For Linux system administrators, it is crucial to...
1: django-admin.py startproject project name 2: c...
Table of contents 1. How to switch 2. Dynamically...
Table of contents 1. Project Requirements Second,...
Native js realizes the carousel effect (seamless ...
Docker Swarm is a container cluster management se...
Table of contents Introduction Create a Next.js p...