When learning Vue.js, a Vue project was created with VUE-CLI, and a line of code in the Main.js file did not know what it meant. Search online to get the following answers:
Reference one: https://www.cnblogs.com/longying2008/p/6408753.html
Reference two: https://www.cnblogs.com/whkl-m/p/6970859.html
Main.js File Contents
Import vue from ' Vue ' import App from './app ' Vue.config.productionTip = False //Set False to prevent Vue from generating production tips at startup */ Eslint-disable no-new */New Vue ({ el: ' #app ', render:h = h (APP) })
Note:/* eslint-disable no-new * * This is not a comment, in JS, the new object needs to be assigned to a value (variable), when instantiated with Vue, do not need to assign a value (variable), so you need to assign a rule to the new This line of code in Vue adds this comment, skipping the check of this code rule through eslint-disable. is one of the common techniques of eslint.
Anyway
Render:h = h (App) This is an arrow function is affirmative, that corresponds to the es5 form is what???
As follows:
{ render:h = h (App)}
Equivalent to:
{ render:h =>{ return H (App) }}
Equivalent to:
{ render:function (h) { return H (App); }}
That
{ render:function (createelement) { return createelement (APP);} }
createelement parameters
Actually read the official document of createelement, I still do not understand createelement usage. How many parameters do the CreateElement method have? What are the meanings and types of each parameter?
Cases:
<! DOCTYPE html>
What does render:h = h (App) mean?