Comparative Description: new Vue () and export default {}
vue is a constructor
vue component is an extension of what is https://www.cnblogs.com/w-wanglei/p/5851629.html HTML tag components: Component Vue.js is one of the most powerful features. HTML elements that could be extended, the package reusable code. At a high level, the component is a custom element, Vue.js compiler to add special features to it. In some cases, the component may be a native form of HTML elements, it is characteristic to expand. (Multiplexed within Vue.component page)
In the production, export, import, use Vue assembly when a novice like me will often be located in different files new Vue()
and export default{}
hangs up. What is their meaning in the end, what similarities and differences do?
First, what Vue that? po main Vue is understood that a constructor, the generated instance is a huge object may contain data, templates, loading elements, methods, and other options lifecycle hooks.
So when rendering, you can use the Vue construct examples of ways to render the corresponding html page:
new Vue({
el: '#app'
...
})
Then export default {} is used to doing it? (Between pages Multiplexing)
This is the time multiplexing components used. Suppose we write a single document page components A, B and another document which need it, then we must use the import / export of grammar ES6 , document A is defined in the output interface export **
, the file B is introduced import **
, then regenerated into a Vue example new Vue (**)
, by introducing the components together, so that you can reuse assembly a to B generates a file with the html page.
So in reusable component, export
and new Vue
indispensable.
In the production, export, import, use Vue assembly when a novice like me will often be located in different files new Vue()
and export default{}
hangs up. What is their meaning in the end, what similarities and differences do?
First, what Vue that? po main Vue is understood that a constructor, the generated instance is a huge object may contain data, templates, loading elements, methods, and other options lifecycle hooks.
So when rendering, you can use the Vue construct examples of ways to render the corresponding html page:
new Vue({
el: '#app'
...
})
Then export default {} is used to doing it? (Between pages Multiplexing)
This is the time multiplexing components used. Suppose we write a single document page components A, B and another document which need it, then we must use the import / export of grammar ES6 , document A is defined in the output interface export **
, the file B is introduced import **
, then regenerated into a Vue example new Vue (**)
, by introducing the components together, so that you can reuse assembly a to B generates a file with the html page.
So in reusable component, export
and new Vue
indispensable.