Vue.js -. 6 Creating Components

Vue component
assembly is to split the code amount Vue example, can be defined in various different functional components of
the method to create assembly
1.
// Create the component
the let COM1 = Vue.extend ({
Template: '<h1 of> hellow </ h1 of> '// must be tagged name
})
Vue.component (' myCon1 ', COM1)
reference <My-CON1> </ My-CON1>
// hump or without

The second
Vue.component ( 'myCon1', {
Template: '<h1 of> hellow </ h1 of>'
})

A third
Vue.component ( 'myCon1', {
Template: '# TMP1'
})
out App
<Template ID = "TMP1">
<h1 of> Hollow </ h1 of>
</ Template>

Guess you like

Origin www.cnblogs.com/ruogu/p/10945678.html