[Wakagawa Vision x Source Code Reading] Issue 23 | Why Vue2 this can directly get data and methods

Source code common reading preface

In order to help more students who are interested in source code, want to learn to read source code, and improve their writing and front-end technical abilities. Help readers consolidate the foundation, check for leaks and fill gaps, broaden their horizons, broaden their horizons, and know why they are.

I did my best to organize a weekly source code reading activity of about 200 lines. I have written more than 20 articles in the "Learning Source Code Overall Architecture Series" .

Welcome (jia) I WeChat  ruochuan12 to  communicate and participate in  the source code reading  activity. Every week, everyone learns about 200 lines of source code and makes progress together. You can continue to follow me @ Ruo Chuan .

Recommended learning order from easy to difficult

The activity introduction and order are detailed here . The recommended learning order from easy to difficult

Submit Notes

How to submit notes In short: read the tasks, read the auxiliary articles, read the source code, communicate and discuss, write notes in the Nuggets, and submit them to the comment area of ​​this article after writing.

In order to benefit everyone, and to bring more readings to everyone's articles and facilitate search, from March 27, 2022, notes can be directly published in the Nuggets, in the "[Wakakawa Vision x Source Code Reading Together]" section Several Issues | Title Naming" The first sentence at the beginning of the article added: This article participated in the weekly source code reading activity initiated by the public account @ Ruo Chuan Vision , click for details to participate together.

After writing your notes, go to the article comment area of ​​the current event to leave a message about your article and note features. It is convenient for everyone to read, learn, exchange and discuss.

All previous notes are stored in the Yuque discussion area .

task release time

From February 14th to February 20th, for a week. The source code is generally released once a week. You can study at your own pace, just submit your notes (not necessarily strictly according to the time I set). You can also review in time if you read together in the past, and you can continue to complete the notes if you haven’t completed them. \

learning target

  1. How to learn to debug vue2 source code
  2. Why can the data in data be obtained directly with this
  3. Why can the methods in methods be directly obtained with this
  4. Learn the excellent codes and ideas in the source code, and put them into your own projects

assignment

  • Those who have not used vue2 can also learn . There are many basic knowledge that can be reviewed and consolidated. For example, the constructor this points to call, bind, and apply Object.defineProperty. Of course, you don’t have to learn this period if you don’t want to learn it.
  • Reference article: Why can Vue2 this get data and methods directly? Source code revealed!
  • Learn to debug vue2 source code by yourself.

Guess you like

Origin juejin.im/post/7082984422516981796