<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="js/vue.js"></script>
</head>
<body>
<div id="app">
<!-- <myComponent></MyComponent> -->
<!-- <my-component></my-component> -->
</div>
<div id="box">
<my-component></my-component>
</div>
<template id="btn">
<button @click="add">你点了{{count}}次</button>
</template>
<script>
Vue.component('MyComponent', {
data(){
return {
count:0,
}
},
//template:'<button @click="add">你点了{{count}}次</button>',
template:'#btn',
methods: {
add(){
this.count++;
}
},
computed: {
}
});
//Vue.component('MyComponent', {});
new Vue({
el: '#app',
data: {
count:0,
},
methods: {
},
computed: {
},
template:'<MyComponent></MyComponent>',
template:'<my-component></my-component>',
template:'<MyComponent />',
});
new Vue({
el:'#box',
});
</script>
</body>
</html>