1、组件声明
<!-- 全局组件模板father模板 -->
<template id="father">
<div>
<h3>这是{
{name}}</h1>
<div>
<p>这是{
{data}}</p>
</div>
</div>
</template>
var FATHER = {
template: "#father",
data: function() {
return {
name: "一个全局组件-模板-",
data: "数据:18892087118"
}
}
};
2、组件注册
Vue.component('father', FATHER);
3、组件挂载
<h5>全局组件1</h5>
<father></father>
4、组件实例
<!DOCTYPE html>
<html>
<head>
<tit