vue中component组件化,两个h1,button为什么会显示不了button?单独一个h1、button不采用component就可以实现
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div id="app">
<counter></counter>
<counter></counter>
<!--
<button type="button" @click="count +=1">Submit{{ count }}</button>
-->
</div>
<template id="counter-template">
<h1>Hello</h1>
<button type="button" @click="count++">Submit {{ count }}</button>
</template>
<script type="text/javascript" src="js/vue.min.js" ></script>
<script>
Vue.component('counter',{
template:'#counter-template',
data:function(){
count:0
}
});
new Vue({
el:'#app',
});
</script>
</body>
</html>