This commit is contained in:
Code12121 2022-10-20 13:56:31 +08:00
parent f739a76c00
commit 0493141580
2 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,44 @@
<!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>
这是局部组件下<dps></dps>
</div>
</div>
</div>
</body>
<script src="../../JavaScript/vue.min.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>

View File

@ -0,0 +1,41 @@
<!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">
<app></app>
<cpn></cpn>
</div>
<div id="cpn">
</div>
</body>
<script src="../../JavaScript/vue.min.js"></script>
<script>
const son=Vue.extend({
template:`
<h1>这是子组件</h1>
`
})
const father=Vue.extend({
template:`
<h1>这是父组件</h1>
`,
components:{
cpn:son
}
}
)
const app=new Vue({
el:"#app",
components:{
'app':father
}
})
</script>
</html>