<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<!-- <cpn>
<h2>我是标题</h2>
</cpn> -->
<div id="app">
<my-cpn></my-cpn>
<my-cpn></my-cpn>
<my-cpn></my-cpn>
<my-cpn></my-cpn>
<div>
<div>
<my-cpn></my-cpn>
</div>
</div>
</div>
<script src="./js/vue.js">
</script>
<script>
const conc = Vue.extend({
template: `<div><h2>全局组件</h2></div>`
})
/* 全局组件 */
Vue.component('my-cpn', conc)
const app = new Vue({
el: '#app',
data: {
message: 'geyao',
age: ''
},
})
</script>
</body>
</html>
运行结果