# Vue

Vue是一个前端框架

# v-model


<template>
<div class="addAndMin">
  <div @click="add">+</div>
  <div class="cont">{{step_}}</div>
  <div @click="minus">-</div>
</div> 
      
</template>
    
<script> 
export default {
  name: 'step-size',
  props: {
    step:{
      type: Number,
      default: 50,
    },
    size: {
      type:Number,
      default: 5
    }
  },
  watch: {
    step_ (value) {
      this.$emit('input',value);
    }
  },
  data () {
    return {
      step_:this.step
    };
  },
  methods:{
    add () {
      this.step_ = this.step_ + this.size;
    },
    minus () {
      this.step_ = this.step_ - this.size; 
    }
  }
    
};
</script>
    
<style scoped>
.addAndMin {
  display: flex;
  height: 40px;
  border: 1px solid #dcdee3;
  border-radius: 4px;
  width: 142px;
  color: #6b707f;
}
.addAndMin div {
  display: inline-block;
  width: 40px;
  height: 40px;
  line-height: 36px;
  text-align: center;
  font-size: 20px;
  cursor: pointer;
}
.addAndMin .cont {
  cursor: auto;
  width: 60px;
  font-size: 14px;
  border: none;
  border-right: 1px solid #dcdee3;
  border-left: 1px solid #dcdee3;
}
</style>


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
最后更新时间: 10/24/2019, 2:19:24 PM