[new feature] Stepper add plus & minus event (#294)
* [bugfix] CouponList always show empty info * [bugfix] add click feedback of buttons in components * [Doc] add custom theme document * [new feature] Notice bar support more props * [bugfix] PullRefresh test cases * [bugfix] unused NoticeBar style * [bugfix] Swipe width calc error * [Doc] english document of all action components * [Doc] change document site path to /zanui/vant * [Doc] fix * [bugfix] uploader style error * [bugfix] tabs document demo * [new feature] Cell support vue-router target route * [bugfix] add cell test cases * update yarn.lock * [bugfix] Tabbar cann't display info when use icon slot * [Doc] update document title * [bugfix] Dialog should reset button text when showed * [new feature] CouponList add showCloseButton prop * [new feature] Swipe add 'initialSwipe' prop * [bugfix] NoticeBar text disappeared when page back * [new feature] ImagePreview support startPosition * fix: improve imagePreview test cases * [bugfix] Steps style error when has more than 4 items * [new feature] normalize size of all icons * [new feature] Stepper add plus & minus event * fix: yarn.lock * [bugfix] addressEdit icon render failed
This commit is contained in:
@@ -13,11 +13,11 @@
|
||||
@input="$emit('input', $event)"
|
||||
@focus="handleFocus"
|
||||
@blur="handleBlur"
|
||||
>
|
||||
<template slot="icon">
|
||||
>
|
||||
<div slot="icon">
|
||||
<span v-if="showIcon && isAndroid" class="van-address-edit-detail__finish-edit">完成</span>
|
||||
<van-icon v-else-if="showIcon" name="clear" />
|
||||
</template>
|
||||
</div>
|
||||
</van-field>
|
||||
|
||||
<van-cell-group class="van-address-edit-detail__suggest-list" v-if="showSearchList">
|
||||
|
||||
+19
-17
@@ -1,24 +1,23 @@
|
||||
<template>
|
||||
<div class="van-stepper" :class="{ 'van-stepper--disabled': disabled }">
|
||||
<button
|
||||
@click="handleChange('minus')"
|
||||
class="van-stepper__stepper van-stepper__minus"
|
||||
:class="{
|
||||
'van-stepper__minus--disabled': isMinusDisabled
|
||||
}">
|
||||
:class="{ 'van-stepper__minus--disabled': isMinusDisabled }"
|
||||
@click="onChange('minus')"
|
||||
>
|
||||
</button>
|
||||
<input
|
||||
type="number"
|
||||
class="van-stepper__input"
|
||||
:value="currentValue"
|
||||
@input="handleInputChange"
|
||||
:disabled="disabled || disableInput">
|
||||
:disabled="disabled || disableInput"
|
||||
@input="onInput"
|
||||
>
|
||||
<button
|
||||
@click="handleChange('plus')"
|
||||
class="van-stepper__stepper van-stepper__plus"
|
||||
:class="{
|
||||
'van-stepper__plus--disabled': isPlusDisabled
|
||||
}">
|
||||
:class="{ 'van-stepper__plus--disabled': isPlusDisabled }"
|
||||
@click="onChange('plus')"
|
||||
>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -28,6 +27,9 @@ export default {
|
||||
name: 'van-stepper',
|
||||
|
||||
props: {
|
||||
value: {},
|
||||
disabled: Boolean,
|
||||
disableInput: Boolean,
|
||||
min: {
|
||||
type: [String, Number],
|
||||
default: 1
|
||||
@@ -36,13 +38,10 @@ export default {
|
||||
type: [String, Number],
|
||||
default: Infinity
|
||||
},
|
||||
value: {},
|
||||
step: {
|
||||
type: [String, Number],
|
||||
default: 1
|
||||
},
|
||||
disabled: Boolean,
|
||||
disableInput: Boolean,
|
||||
defaultValue: {
|
||||
type: [String, Number],
|
||||
default: 1
|
||||
@@ -56,6 +55,7 @@ export default {
|
||||
value = correctedValue;
|
||||
this.$emit('input', value);
|
||||
}
|
||||
|
||||
return {
|
||||
currentValue: value
|
||||
};
|
||||
@@ -81,6 +81,7 @@ export default {
|
||||
this.$emit('input', val);
|
||||
this.$emit('change', val);
|
||||
},
|
||||
|
||||
value(val) {
|
||||
val = this.correctValue(+val);
|
||||
if (val !== this.currentValue) {
|
||||
@@ -90,7 +91,6 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 纠正value值
|
||||
correctValue(value) {
|
||||
if (Number.isNaN(value)) {
|
||||
value = this.min;
|
||||
@@ -101,12 +101,13 @@ export default {
|
||||
|
||||
return value;
|
||||
},
|
||||
handleInputChange(event) {
|
||||
const val = +event.target.value;
|
||||
|
||||
onInput(event) {
|
||||
const val = +event.target.value;
|
||||
this.currentValue = this.correctValue(val);
|
||||
},
|
||||
handleChange(type) {
|
||||
|
||||
onChange(type) {
|
||||
if ((this.isMinusDisabled && type === 'minus') || (this.isPlusDisabled && type === 'plus')) {
|
||||
this.$emit('overlimit', type);
|
||||
return;
|
||||
@@ -115,6 +116,7 @@ export default {
|
||||
const step = +this.step;
|
||||
const currentValue = +this.currentValue;
|
||||
this.currentValue = type === 'minus' ? (currentValue - step) : (currentValue + step);
|
||||
this.$emit(type);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
ref="tabkey"
|
||||
@click="handleTabClick(index)"
|
||||
>
|
||||
{{ tab.title }}
|
||||
<span>{{ tab.title }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -31,7 +31,7 @@
|
||||
ref="tabkey"
|
||||
@click="handleTabClick(index)"
|
||||
>
|
||||
{{ tab.title }}
|
||||
<span>{{ tab.title }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="van-tabs__content">
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
.van-icon {
|
||||
display: inline-block;
|
||||
font: normal normal normal 14px/1 "vant-icon";
|
||||
font: normal normal normal 14px/1 "<%= fontName %>";
|
||||
font-size: inherit;
|
||||
text-rendering: auto;
|
||||
|
||||
|
||||
@@ -93,5 +93,9 @@
|
||||
top: 50%;
|
||||
transform: translate3d(0, -50%, 0);
|
||||
padding: 10px;
|
||||
|
||||
.van-icon {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user