<!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>
</div>
<script src="./js/vue.js">
</script>
<script type="text/x-template" id="cpn">
<div>
<h2>我是标题</h2>
<p>我是内容</p>
</div>
</script>
<script>
Vue.component('my-cpn', {
template: `#cpn`
})
const app = new Vue({
el: '#app',
data: {
message: 'geyao',
age: ''
},
})
</script>
</body>
</html>
运行结果