javascript - vue component为什么不显示?
本文介绍了javascript - vue component为什么不显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
<!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>
<ol>
<!-- 创建一个 todo-item 组件的实例 -->
<todo-item></todo-item>
</ol>
<script src="https://unpkg.com/vue"></script>
<script>
Vue.component('todo-item', {
template: '<li>这是个待办项</li>'
})
</script>
</body>
</html>
初学vue
,为什么我这边显示的是一个空白页面,组件模板的写法是错的么?
解决方案
html里面是这样的
<div id='app'>
<v-header></v-header>
</div>
js 是这样的
Vue.component('vHeader', {
template: '<div>A custom component!</div>'
})
new Vue({
el:'#app',
})
这篇关于javascript - vue component为什么不显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文