<html>
<head>
<script src="vue.js"></script>
</head>
<body>
<div id="app" v-cloak>
<public-component></public-component>
</div>
</body>
<script>
//全局组件
Vue.component("PublicComponent",{
data(){
return {
title:"我是公共组件"
}
},
template:`
<div>
{
{title}}
</div>
`
})
new Vue({
el:"#app",
})
</script>
</html>
vue2全局组件
猜你喜欢
转载自blog.csdn.net/qq_26798533/article/details/120307600
今日推荐
周排行