In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "created use case analysis in vue". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope this "created use case analysis in vue" article can help you solve the problem.
In vue, the created hook function is called after the instance is created. Created is a lifecycle hook function. After a vue instance is generated, there will be a hook function at each stage to facilitate handling different logic at different stages. Generally, you can call ajax in the created function to obtain data.
This article operating environment: windows10 system, Vue2.9.6 version, DELL G3 computer.
When does vue use created?
The created method in vue.js is a lifecycle hook function that is called when a vue instance is generated. A vue instance is generated and bound to a html element, which is then compiled and then inserted into document. Each stage has a hook function that makes it easy for developers to deal with different logic at different stages.
Generally, you can call ajax in the created function to get the data needed for page initialization.
Instance life cycle
Each Vue instance goes through a series of initialization processes before it is created. For example, the instance needs to configure data observation (data observer), compile the template, mount the instance to DOM, and then update the DOM when the data changes. In the process, the instance also calls some lifecycle hooks, which gives us the opportunity to execute custom logic. For example, the created hook function is called after the instance is created:
Var vm = new Vue ({data: {a: 1}, created: function () {/ / `this` points to vm instance console.log ('an is:', this.a)}})
There are also other hooks that are called at different stages of the instance life cycle, such as mounted, updated, destroyed. The this in the hook function points to the Vue instance that called it. Some children's shoes may ask Vue.js if there is a concept of "controller"? The answer is no. The custom logic of the component can be distributed among these hooks.
This is the end of the introduction to "created usage case Analysis in vue". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.