admin_vue/10-组件化开发/02-全局组件与局部组件/全局组件与局部组件.html

45 lines
827 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="app_all">
<dps></dps>
<pds></pds>
<div id="app_part">
<pds></pds>
<div>
<label for="">这是局部组件下</label>
<dps></dps>
</div>
</div>
</div>
</body>
<script src="../../00-tools/JavaScript/vue.js"></script>
<script>
Vue.component(
'dps',{
template:`
<h1>这是全局组件</h1>
`
}
)
const vue=new Vue({
el:"#app_all"
})
new Vue({
el:"#app_part",
components:{
pds:{
template:`
<h1>这是局部组件</h1>
`
}
}
})
</script>
</html>