<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>组件基础</title>
</head>
<body>
<div id="app">
<greeting to="mike">Hello,</greeting>
<greeting to="jane">Hello,</greeting>
</div>
<script src="../js/vue.js"></script>
<script>
Vue.component('greeting',{
data:function () {
return {
count:0
}
},
props:['to'],
methods:{
doClick:function () {
this.count++;
console.log(this.count);
}
},
template:'<button v-on:click="doClick"><slot></slot>{{to}} x {{count}}</button>',
});
let vm = new Vue({
el:'#app'
});
</script>
</body>
</html>
vue-前端第9章component05.html
原创
©著作权归作者所有:来自51CTO博客作者虾米大王的原创作品,请联系作者获取转载授权,否则将追究法律责任

提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
vue-前端第9章component04.html
【代码】vue-前端第9章component04.html。
vue.js html Vue -
vue-前端第9章component06.html
【代码】vue-前端第9章component06.html。
vue.js html Vue -
vue-前端第9章component01.html
【代码】vue-前端第9章component01.html。
vue.js html Vue -
vue-前端第9章component03.html
【代码】vue-前端第9章component03.html。
vue.js html Vue -
vue-前端第9章component07.html
【代码】vue-前端第9章component07.html。
vue.js html Vue -
vue-前端第9章component08.html
【代码】vue-前端第9章component08.html。
vue.js javascript 前端 html Vue -
vue-前端第9章component02.html
【代码】vue-前端第9章component02.html。
vue.js javascript 前端 html Vue -
vue-前端第3章watch05.html
【代码】vue-前端第3章watch05.html。
vue.js javascript 前端 html ci -
vue-前端第2章instance05.html
【代码】vue-前端第2章instance05.html。
vue.js javascript 前端 html ci -
vue-前端第6章form05.html
【代码】vue-前端第6章form05.html。
javascript 前端 dreamweaver python php -
vue-前端第4章class05.html
【代码】vue-前端第4章class05.html。
javascript vue.js 前端 html css -
vue-前端第12章transition05.html
【代码】vue-前端第12章transition05.html。
html javascript 前端 ide 开发技术 -
vue-前端第3章computed05.html
【代码】vue-前端第3章computed05.html。
vue.js javascript 前端 html Math -
vue-前端第7章v-if05.html
【代码】vue-前端第7章v-if05.html。
vue.js javascript 前端 html Vue -
vue-前端第5章event05.html
【代码】vue-前端第5章event05.html。
vue.js javascript 前端 html Vue -
vue-前端第8章demoTwo05.html
【代码】vue-前端第8章demoTwo05.html。
vue.js sed ico html -
vue-前端第11章ajax-demo05.html
【代码】vue-前端第11章ajax-demo05.html。
javascript 前端 html ios ajax -
vue-案例教程第7章05.html
【代码】vue-案例教程第7章05.html。
vue.js html css Java -
vue-案例教程第4章05.html
【代码】vue-案例教程第4章05.html。
javascript 前端 vue.js html i++