Vue组件-创建和使用

Vue 组件

全局组件

  1. 创建组件构造器

Vue.extend(options)

需在构造器中编写模板template,用于说明这个组件中要写什么元素

注意:

  • template 中只能有一个根元素,若有多个,需放在
1
2
3
let Profile = Vue.extend({
template: "<p></p>",
});

在编写 template 时,由于相当于是在

Vue-组件切换&动态组件 解决国内访问GitHub pages太慢的方法

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×