<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>全局注册</title>
</head>
<script src="vue.js"></script>
//引入vue.js文件运行
<body>
<div id="app1">
<child></child>
<father></father>
</div>
<script>
Vue.component('child',{
template:'<span>{{text}}</span>',
data:function(){
return{
text:'我是子组件'
}
}
})
Vue.component('father',{
template:'<div><child></child></div>'
})
new Vue({
el:'#app1'
})
</script>
</body>
</html>
vue组件1-全局注册
最新推荐文章于 2024-07-15 16:14:03 发布