This commit is contained in:
Code12121 2022-10-17 10:01:08 +08:00
parent 555523c27f
commit 1ed7de1b91
4 changed files with 31 additions and 40 deletions

View File

@ -1,16 +0,0 @@
<!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="../js/vue.min.js"></script>
<script src="../js/index.js"></script>
</html>

View File

@ -1,13 +0,0 @@
const create = Vue.extend({
template: `
<div>
<h1>这是一个标签</h1>
</div>
`
})
const cpn = Vue.component(
'cpn', create
)
const vue = new Vue({
el: "#app",
})

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,31 @@
<!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>