标签:src tle http type css char har https template
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>全局组件、局部组件</title>
<script src="https://cdn.bootcss.com/vue/2.2.2/vue.min.js"></script>
</head>
<body>
<div id="app">
<component></component>
</div>
<div id="app2">
<component1></component1>
<div is="component1"></div>
</div>
<script>
// 注册
Vue.component(‘component‘, {
template: ‘<h1>全局组件!</h1>‘
})
// 创建根实例
new Vue({
el: ‘#app‘
});
var Child = {
template: ‘<h1>局部组件!</h1>‘
};
// 创建根实例
new Vue({
el: ‘#app2‘,
components: {
‘component1‘: Child
}
})
</script>
</body>
</html>
标签:src tle http type css char har https template
原文地址:http://www.cnblogs.com/mark20170707/p/7506999.html