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. Introduction Since pictures take up a lot of s...
Xiaobai records the installation of vmtools: 1. S...
1 Download MySQL8 from the official website and i...
Table of contents Preface Dynamic SQL 1. Take a l...
<body> <div id="root"> <...
1. Download the download link Click download. You...
1. Request answer interface 2. Determine whether ...
Table of contents Preface 1. Paste Events and Cli...
As shown above, the navigation is fixed at the to...
NERDTree is a file system browser for Vim. With t...
Table of contents Requirement: Query ongoing acti...
Preface As we all know, the browser's homolog...
Table of contents 1. Back up the old MySQL5.7 dat...
Preface This article mainly introduces the releva...
This article example shares the specific code of ...