31 lines
625 B
HTML
31 lines
625 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">
|
||
<cpn></cpn>
|
||
</div>
|
||
</body>
|
||
<script src="../../00-tools/JavaScript/vue.js"></script>
|
||
<script>
|
||
// 易犯错点:创建组件和初始化组件时不需要new一个对象
|
||
const extend= Vue.extend({
|
||
template:`
|
||
<div>
|
||
<h1>你好呀</h1>
|
||
</div>
|
||
`
|
||
})
|
||
Vue.component(
|
||
'cpn',extend
|
||
)
|
||
const vue=new Vue({
|
||
el:"#app"
|
||
})
|
||
</script>
|
||
</html> |