mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-05-23 15:09:16 +08:00
[bugfix] Stepper: 修复iPad下或修改input高度时输入框样式异常 (#1086)
This commit is contained in:
parent
3cb142b8f5
commit
5fe840ad2b
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
&__minus,
|
&__minus,
|
||||||
&__plus,
|
&__plus,
|
||||||
&__input {
|
&__input-wrapper {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
background-color: @white;
|
background-color: @white;
|
||||||
@ -13,12 +13,12 @@
|
|||||||
|
|
||||||
&__minus,
|
&__minus,
|
||||||
&__plus {
|
&__plus {
|
||||||
|
position: relative;
|
||||||
width: 40px;
|
width: 40px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
box-sizing: border-box;
|
|
||||||
border: 1px solid @border-color;
|
|
||||||
position: relative;
|
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
|
border: 1px solid @border-color;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
width: 9px;
|
width: 9px;
|
||||||
@ -32,14 +32,14 @@
|
|||||||
|
|
||||||
&::before,
|
&::before,
|
||||||
&::after {
|
&::after {
|
||||||
content: '';
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin: auto;
|
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
margin: auto;
|
||||||
background-color: @gray-darker;
|
background-color: @gray-darker;
|
||||||
|
content: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
@ -72,23 +72,32 @@
|
|||||||
border-radius: 0 2px 2px 0;
|
border-radius: 0 2px 2px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__input {
|
&__input-wrapper {
|
||||||
width: 33px;
|
position: relative;
|
||||||
height: 26px;
|
width: 35px;
|
||||||
|
height: 30px;
|
||||||
padding: 1px;
|
padding: 1px;
|
||||||
min-height: 0; // reset wechat default min height
|
font-size: 14px;
|
||||||
|
color: @gray-darker;
|
||||||
|
text-align: center;
|
||||||
border: 1px solid @border-color;
|
border: 1px solid @border-color;
|
||||||
border-width: 1px 0;
|
border-width: 1px 0;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
box-sizing: content-box;
|
box-sizing: border-box;
|
||||||
color: @gray-darker;
|
|
||||||
font-size: 14px;
|
|
||||||
text-align: center;
|
|
||||||
-webkit-appearance: none;
|
|
||||||
|
|
||||||
&--disabled {
|
&--disabled {
|
||||||
color: @gray;
|
color: @gray;
|
||||||
background-color: @background-color;
|
background-color: @background-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__input {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 0; // reset wechat default min height
|
||||||
|
transform: translate3d(-50%, -50%, 0);
|
||||||
|
appearance: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,10 @@ VantComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
data: {
|
||||||
|
focus: false
|
||||||
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.set({
|
this.set({
|
||||||
value: this.range(this.data.value)
|
value: this.range(this.data.value)
|
||||||
@ -57,6 +61,12 @@ VantComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
onFocus() {
|
||||||
|
this.setData({
|
||||||
|
focus: true
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
// limit value range
|
// limit value range
|
||||||
range(value) {
|
range(value) {
|
||||||
return Math.max(Math.min(this.data.max, value), this.data.min);
|
return Math.max(Math.min(this.data.max, value), this.data.min);
|
||||||
|
@ -3,14 +3,17 @@
|
|||||||
class="minus-class van-stepper__minus {{ minusDisabled ? 'van-stepper__minus--disabled' : '' }}"
|
class="minus-class van-stepper__minus {{ minusDisabled ? 'van-stepper__minus--disabled' : '' }}"
|
||||||
bind:tap="onMinus"
|
bind:tap="onMinus"
|
||||||
/>
|
/>
|
||||||
<input
|
<view class="input-class van-stepper__input-wrapper {{ disabled || disableInput ? 'van-stepper__input-wrapper--disabled' : '' }}" bindtap="onFocus">
|
||||||
type="{{ integer ? 'number' : 'digit' }}"
|
<input
|
||||||
class="input-class van-stepper__input {{ disabled || disableInput ? 'van-stepper__input--disabled' : '' }}"
|
type="{{ integer ? 'number' : 'digit' }}"
|
||||||
value="{{ value }}"
|
class="van-stepper__input"
|
||||||
disabled="{{ disabled || disableInput }}"
|
value="{{ value }}"
|
||||||
bindinput="onInput"
|
focus="{{ focus }}"
|
||||||
bind:blur="onBlur"
|
disabled="{{ disabled || disableInput }}"
|
||||||
/>
|
bindinput="onInput"
|
||||||
|
bind:blur="onBlur"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
<view
|
<view
|
||||||
class="plus-class van-stepper__plus {{ plusDisabled ? 'van-stepper__plus--disabled' : '' }}"
|
class="plus-class van-stepper__plus {{ plusDisabled ? 'van-stepper__plus--disabled' : '' }}"
|
||||||
bind:tap="onPlus"
|
bind:tap="onPlus"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user