vue222/10-组件化开发/01-组件的基本使用/组件开发简单使用.html

31 lines
620 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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="../../JavaScript/vue.min.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>