VUE多个组件示例
示例一
多个组件示例Vue.component('app-header', {
template: `
头部组件
})
Vue.component('app-main', {
template: `
- 用户管理
- 账单管理
- 供应商管理
})
Vue.component('app-footer', {
template: `
`,})
// 定义局部组件对象
const ComponentB = {
template: '
这是 {
{name}}
',
data() {
return {
name: '局部组件'
}
},
}
new Vue({
el: '#app',
components: {
// key:value ; key为组件名,value是组件对象。
'component-b': ComponentB
},
data: {