<template>
<div class="coutter-wrapper">
<button type="button" @click="plus">+</button>
<button type="button">{{ result }}</button>
<button type="button" @click="minus">-</button>
</div>
</template>
<script>
export default {
data() {
return {
result: 0,
}
}
,
methods: {
minus() {
this.result--;
this.$emit('input', {res: this.result, other: '--'})
},
plus() {
this.result++;
this.$emit('input', {res: this.result, other: '++'})
}
}
}
</script>
<style lang="stylus" scoped>
button
border 0
outline 0
border-radius 3px
button:nth-child(2)
width 200px
</style>
posted @
2017-06-08 21:08
安心牧羊人
阅读(
5742)
评论()
编辑
收藏
举报