On the link between father and son Vue.js components

First we thought object-oriented programming rather than process-oriented, so the idea is to provide us with Vue DOM component of the future will be operated. The method of assembly is to use Vue new new () constructor implemented, create an instance of the Vue, and mount on a Dom element, then through Vue.extend () method creates individual components, and then by Vue.component (xx, xx) to (V) mounted in a global register (on the new Vue ({li}) with the components: {} partial registration). So that we can use our custom set up in the mount. || You can also template template:

< template id= "hello-box" >
<-! Template in direct child element must have one and only one ->
< Div > Hello </ div >
</ template >
.....
</body>
 
.....
<script>
/*
template template tags
Example 1. template tag is placed outside the range of the template
When the external layer 2. template tag will not be parsed, that will appear in the dom structure, if placed within the scope of example, it will be resolved, the future does not appear in the dom structure
3. template in direct child element must have one and only one
*/

Vue. component( 'Hello',{
// template: '<div> 今年的目标: 找一个好的高薪工作 </div>'
template: '#hello-box'
})
 
 
< template id= "hello-box" >
<!-- template中直接子元素必须有且仅有一个 -->
< div > 你好 </ div >
</ template >

Guess you like

Origin www.cnblogs.com/zhangzhouy/p/11402154.html