标签:vue组件 char enter name cdn https htm utf-8 tps
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<title>vue组件的使用</title>
<style>
body{
color:burlywood;
}
.header{
width: 100%;
height: 40px;
background-color: #333;
line-height: 40px;
text-align: center;
}
</style>
</head>
<body>
<div id=‘app‘></div>
<script>
// 1.声明组件
var Vheader = {
template : `
<div class=‘header‘>
头部区域
</div>
`,
}
new Vue({
el:‘#app‘,
data(){
return{
}
},
// 3.使用组件
template:`
<Vheader/>
`,
// 2.挂载组件
components:{
Vheader,
}
})
</script>
</body>
</html>
标签:vue组件 char enter name cdn https htm utf-8 tps
原文地址:https://www.cnblogs.com/shannen/p/12491308.html