在main.ts 中添加
Vue.component('sayHello',{ render(h){ return h('p',{ style:{ color:'red' } },`早上好`)//格式是`${this.userName}` }, data(){ return{ userName:'小明' } } })
注意参数说明:h(标签,属性,值)
在各组件中使用
<sayHello></sayHello>
在main.ts 中添加
Vue.component('sayHello',{ render(h){ return h('p',{ style:{ color:'red' } },`早上好`)//格式是`${this.userName}` }, data(){ return{ userName:'小明' } } })
注意参数说明:h(标签,属性,值)
在各组件中使用
<sayHello></sayHello>