Vue mounted components


The hook function is part of the Windows message processing mechanism. By setting “hook”, the application can perform all messages, events on the system level. Filter, access messages that cannot be accessed under normal conditions. The essence of the hook is a program used to handle system messages, and hang it into the system through system call. (Baidu Encyclopedia)

for the front end

For the front end, the hook function refers to the execution of all the functions, I will execute first. The function, that is, hook the function I am interested, as long as it is executed, I will execute it.

3. Mounted

in this launch of the backend request, take the data, and match the route hook to do something

type: Function

Details:

el is replaced by the newly created vm.el, and mount the hook after the call instance up. If the root instance mounted an element, the hook is called when the mounted is called, and the hook is called after it is mounted to the instance. If the root instance is mounted in an document, Vm.el is also called in the document when MOUNTED is called
The hook is not called during server-side rendering.

4. Code instance

 New Vue ({EL: '#App', Data: {TotalMoney: 0, ProductList: []}, Filters : {}, mounted: function () {// This is the hook function // If the CARTVIEW function is to be executed, the hook function // This hook function must be done to complete the call to the CratView function, it should be noted, using mounted Cannot guaranteeTHIS in the hook function in the hook function is in the Document. To this end, Vue.NextTick / Vm should also be introduced $ NextTICK this. $ Nexttick () {this.cartView ()})}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} Var _this = this; this. $ http.get ("Data / CartData.json", {"ID": 123}). Then (Function (RES) {_this.productList = Res. Body.Result.list; _this. TotalMoney = res.};}}}};   
If you want to learn more invested in Vue.js, please refer to Vue.js actual combat PDF high quality scan version This classic book

The above is all the content of this article, I hope to help everyone, I hope everyone will support Tumi Cloud.

© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment