Commit 7309b43422a065ccb380bb773a6db7a0e5c8ce41

Authored by 梁灏
1 parent 9271ce9d

InputNumber add `editable` property.

examples/routers/input-number.vue
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <!--<div @click="changeMax">change max</div>--> 6 <!--<div @click="changeMax">change max</div>-->
7 <!--<Input-number disabled :max="10" :min="1" :step="1.2" v-model="v2"></Input-number>--> 7 <!--<Input-number disabled :max="10" :min="1" :step="1.2" v-model="v2"></Input-number>-->
8 <!--<Input-number :max="10" :min="1" v-model="obj.v"></Input-number>--> 8 <!--<Input-number :max="10" :min="1" v-model="obj.v"></Input-number>-->
9 - <InputNumber :max="10" :min="1" :step="1.2" v-model="value2"></InputNumber> 9 + <InputNumber :editable="false" :max="10" :min="1" :step="1.2" v-model="value2"></InputNumber>
10 <InputNumber :precision="1" :max="10" :min="1" :step="0.1" v-model="value1"></InputNumber> 10 <InputNumber :precision="1" :max="10" :min="1" :step="0.1" v-model="value1"></InputNumber>
11 </div> 11 </div>
12 </template> 12 </template>
src/components/date-picker/base/time-spinner.vue
@@ -182,15 +182,15 @@ @@ -182,15 +182,15 @@
182 watch: { 182 watch: {
183 hours (val) { 183 hours (val) {
184 if (!this.compiled) return; 184 if (!this.compiled) return;
185 - this.scroll('hours', this.hoursList.findIndex(obj => obj.text == val)); 185 + this.scroll('hours', this.hoursList.findIndex(obj => obj.text == val));
186 }, 186 },
187 minutes (val) { 187 minutes (val) {
188 if (!this.compiled) return; 188 if (!this.compiled) return;
189 - this.scroll('minutes', this.minutesList.findIndex(obj => obj.text == val)); 189 + this.scroll('minutes', this.minutesList.findIndex(obj => obj.text == val));
190 }, 190 },
191 seconds (val) { 191 seconds (val) {
192 if (!this.compiled) return; 192 if (!this.compiled) return;
193 - this.scroll('seconds', this.secondsList.findIndex(obj => obj.text == val)); 193 + this.scroll('seconds', this.secondsList.findIndex(obj => obj.text == val));
194 } 194 }
195 }, 195 },
196 mounted () { 196 mounted () {
src/components/input-number/input-number.vue
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 @blur="blur" 25 @blur="blur"
26 @keydown.stop="keyDown" 26 @keydown.stop="keyDown"
27 @change="change" 27 @change="change"
28 - :readonly="readonly" 28 + :readonly="readonly || !editable"
29 :name="name" 29 :name="name"
30 :value="precisionValue"> 30 :value="precisionValue">
31 </div> 31 </div>
@@ -102,6 +102,10 @@ @@ -102,6 +102,10 @@
102 type: Boolean, 102 type: Boolean,
103 default: false 103 default: false
104 }, 104 },
  105 + editable: {
  106 + type: Boolean,
  107 + default: true
  108 + },
105 name: { 109 name: {
106 type: String 110 type: String
107 }, 111 },