mirror of
https://github.com/youzan/vant.git
synced 2026-05-16 01:07:43 +08:00
chore: add trailingComma
This commit is contained in:
@@ -48,7 +48,7 @@ export default {
|
||||
asyncChange: '异步变更',
|
||||
customSize: '自定义大小',
|
||||
disableInput: '禁用输入框',
|
||||
decimalLength: '固定小数位数'
|
||||
decimalLength: '固定小数位数',
|
||||
},
|
||||
'en-US': {
|
||||
step: 'Step',
|
||||
@@ -57,8 +57,8 @@ export default {
|
||||
asyncChange: 'Async Change',
|
||||
customSize: 'Custom Size',
|
||||
disableInput: 'Disable Input',
|
||||
decimalLength: 'Decimal Length'
|
||||
}
|
||||
decimalLength: 'Decimal Length',
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
@@ -71,7 +71,7 @@ export default {
|
||||
stepper6: 1,
|
||||
stepper7: 1,
|
||||
stepper8: 1,
|
||||
disabledInput: 1
|
||||
disabledInput: 1,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -83,7 +83,7 @@ export default {
|
||||
this.stepper6 = value;
|
||||
this.$toast.clear();
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
+17
-17
@@ -31,36 +31,36 @@ export default createComponent({
|
||||
decimalLength: Number,
|
||||
name: {
|
||||
type: [Number, String],
|
||||
default: ''
|
||||
default: '',
|
||||
},
|
||||
min: {
|
||||
type: [Number, String],
|
||||
default: 1
|
||||
default: 1,
|
||||
},
|
||||
max: {
|
||||
type: [Number, String],
|
||||
default: Infinity
|
||||
default: Infinity,
|
||||
},
|
||||
step: {
|
||||
type: [Number, String],
|
||||
default: 1
|
||||
default: 1,
|
||||
},
|
||||
defaultValue: {
|
||||
type: [Number, String],
|
||||
default: 1
|
||||
default: 1,
|
||||
},
|
||||
showPlus: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
showMinus: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
longPress: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
@@ -72,7 +72,7 @@ export default createComponent({
|
||||
}
|
||||
|
||||
return {
|
||||
currentValue: value
|
||||
currentValue: value,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -105,10 +105,10 @@ export default createComponent({
|
||||
|
||||
return {
|
||||
width: size,
|
||||
height: size
|
||||
height: size,
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
@@ -126,7 +126,7 @@ export default createComponent({
|
||||
currentValue(val) {
|
||||
this.$emit('input', val);
|
||||
this.$emit('change', val, { name: this.name });
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
@@ -256,7 +256,7 @@ export default createComponent({
|
||||
if (this.isLongPress) {
|
||||
preventDefault(event);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
render() {
|
||||
@@ -271,8 +271,8 @@ export default createComponent({
|
||||
this.onTouchStart();
|
||||
},
|
||||
touchend: this.onTouchEnd,
|
||||
touchcancel: this.onTouchEnd
|
||||
}
|
||||
touchcancel: this.onTouchEnd,
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
@@ -308,5 +308,5 @@ export default createComponent({
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -4,8 +4,8 @@ import { mount, later } from '../../../test';
|
||||
test('disabled stepper', () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
disabled: true
|
||||
}
|
||||
disabled: true,
|
||||
},
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
@@ -13,8 +13,8 @@ test('disabled stepper', () => {
|
||||
test('disable stepper input', () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
disableInput: true
|
||||
}
|
||||
disableInput: true,
|
||||
},
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
@@ -22,8 +22,8 @@ test('disable stepper input', () => {
|
||||
test('disable button', async () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
value: 5
|
||||
}
|
||||
value: 5,
|
||||
},
|
||||
});
|
||||
|
||||
const plus = wrapper.find('.van-stepper__plus');
|
||||
@@ -37,7 +37,7 @@ test('disable button', async () => {
|
||||
|
||||
wrapper.setProps({
|
||||
disablePlus: true,
|
||||
disableMinus: true
|
||||
disableMinus: true,
|
||||
});
|
||||
|
||||
await later();
|
||||
@@ -52,8 +52,8 @@ test('click button', () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
value: 1,
|
||||
max: 2
|
||||
}
|
||||
max: 2,
|
||||
},
|
||||
});
|
||||
|
||||
const plus = wrapper.find('.van-stepper__plus');
|
||||
@@ -71,8 +71,8 @@ test('click button', () => {
|
||||
test('long press', async () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
value: 1
|
||||
}
|
||||
value: 1,
|
||||
},
|
||||
});
|
||||
|
||||
const plus = wrapper.find('.van-stepper__plus');
|
||||
@@ -93,8 +93,8 @@ test('disable long press', async () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
value: 1,
|
||||
longPress: false
|
||||
}
|
||||
longPress: false,
|
||||
},
|
||||
});
|
||||
|
||||
const plus = wrapper.find('.van-stepper__plus');
|
||||
@@ -108,8 +108,8 @@ test('disable long press', async () => {
|
||||
test('filter value during user input', () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
value: 1
|
||||
}
|
||||
value: 1,
|
||||
},
|
||||
});
|
||||
|
||||
const input = wrapper.find('.van-stepper__input');
|
||||
@@ -132,8 +132,8 @@ test('shoud watch value and format it', () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
value: 1,
|
||||
max: 5
|
||||
}
|
||||
max: 5,
|
||||
},
|
||||
});
|
||||
|
||||
wrapper.setData({ value: 10 });
|
||||
@@ -144,8 +144,8 @@ test('only allow interger', () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
value: 1,
|
||||
integer: true
|
||||
}
|
||||
integer: true,
|
||||
},
|
||||
});
|
||||
|
||||
const input = wrapper.find('input');
|
||||
@@ -168,8 +168,8 @@ test('stepper blur', () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
value: 5,
|
||||
min: 3
|
||||
}
|
||||
min: 3,
|
||||
},
|
||||
});
|
||||
|
||||
wrapper.vm.$on('input', value => {
|
||||
@@ -188,8 +188,8 @@ test('stepper blur', () => {
|
||||
test('input-width prop', () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
inputWidth: '10rem'
|
||||
}
|
||||
inputWidth: '10rem',
|
||||
},
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
@@ -197,8 +197,8 @@ test('input-width prop', () => {
|
||||
test('button-size prop', () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
buttonSize: '2rem'
|
||||
}
|
||||
buttonSize: '2rem',
|
||||
},
|
||||
});
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
@@ -207,8 +207,8 @@ test('async-change prop', () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
value: 1,
|
||||
asyncChange: true
|
||||
}
|
||||
asyncChange: true,
|
||||
},
|
||||
});
|
||||
|
||||
const plus = wrapper.find('.van-stepper__plus');
|
||||
@@ -229,8 +229,8 @@ test('min value is 0', () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
value: 1,
|
||||
min: 0
|
||||
}
|
||||
min: 0,
|
||||
},
|
||||
});
|
||||
|
||||
const input = wrapper.find('input');
|
||||
@@ -245,8 +245,8 @@ test('show-plus & show-minus props', () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
showPlus: false,
|
||||
showMinus: false
|
||||
}
|
||||
showMinus: false,
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
@@ -257,8 +257,8 @@ test('decimal-length prop', () => {
|
||||
propsData: {
|
||||
value: 1,
|
||||
step: 0.2,
|
||||
decimalLength: 2
|
||||
}
|
||||
decimalLength: 2,
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.emitted('input')[0][0]).toEqual('1.00');
|
||||
@@ -273,8 +273,8 @@ test('should limit decimal-length when input', () => {
|
||||
propsData: {
|
||||
value: 1,
|
||||
step: 0.2,
|
||||
decimalLength: 1
|
||||
}
|
||||
decimalLength: 1,
|
||||
},
|
||||
});
|
||||
|
||||
const input = wrapper.find('input');
|
||||
@@ -300,8 +300,8 @@ test('name prop', () => {
|
||||
test('change min and max', async () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
value: 1
|
||||
}
|
||||
value: 1,
|
||||
},
|
||||
});
|
||||
|
||||
wrapper.setProps({
|
||||
@@ -326,12 +326,12 @@ test('change min and max', async () => {
|
||||
test('change decimal-length', async () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
value: 1.33
|
||||
}
|
||||
value: 1.33,
|
||||
},
|
||||
});
|
||||
|
||||
wrapper.setProps({
|
||||
decimalLength: 1
|
||||
decimalLength: 1,
|
||||
});
|
||||
|
||||
await later();
|
||||
@@ -342,12 +342,12 @@ test('change decimal-length', async () => {
|
||||
test('change integer', async () => {
|
||||
const wrapper = mount(Stepper, {
|
||||
propsData: {
|
||||
value: 1.33
|
||||
}
|
||||
value: 1.33,
|
||||
},
|
||||
});
|
||||
|
||||
wrapper.setProps({
|
||||
integer: true
|
||||
integer: true,
|
||||
});
|
||||
|
||||
await later();
|
||||
|
||||
Reference in New Issue
Block a user