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
1. Delete file command: find the corresponding di...
Table of contents Preface Related Materials Vue p...
Introduction When writing SQL today, I encountere...
When logging in to the stress test, many differen...
Suppose Taobao encourages people to shop during D...
MySQL SQL statement performance tuning simple exa...
Table of contents 1. Globally registered componen...
Import: Due to project requirements, we will enca...
How to use the code in NetEase Blog: First log in...
question: I have a form in Vue for uploading blog...
Previously, I introduced the use of the charAt() ...
Use MySQL proxies_priv (simulated role) to implem...
Table of contents Preface 1. Create objects befor...
Result:Implementation Code html <link href=...
In the forum, I saw netizen jeanjean20 mentioned h...