chore: add trailingComma

This commit is contained in:
陈嘉涵
2020-01-19 11:57:09 +08:00
parent e841175fe8
commit 389d68884d
269 changed files with 2706 additions and 2702 deletions
+6 -6
View File
@@ -74,7 +74,7 @@ export default {
customStyle: '自定义样式',
customButton: '自定义按钮',
text: '当前值:',
vertical: '垂直方向'
vertical: '垂直方向',
},
'en-US': {
title1: 'Basic Usage',
@@ -84,8 +84,8 @@ export default {
customStyle: 'Custom Style',
customButton: 'Custom Button',
text: 'Current value: ',
vertical: 'Vertical'
}
vertical: 'Vertical',
},
},
data() {
@@ -96,15 +96,15 @@ export default {
value4: 50,
value5: 50,
value6: 50,
value7: 50
value7: 50,
};
},
methods: {
onChange(value) {
this.$toast(this.$t('text') + value);
}
}
},
},
};
</script>
+12 -12
View File
@@ -14,36 +14,36 @@ export default createComponent({
inactiveColor: String,
min: {
type: Number,
default: 0
default: 0,
},
max: {
type: Number,
default: 100
default: 100,
},
step: {
type: Number,
default: 1
default: 1,
},
value: {
type: Number,
default: 0
default: 0,
},
barHeight: {
type: [Number, String],
default: 2
}
default: 2,
},
},
data() {
return {
dragStatus: ''
dragStatus: '',
};
},
computed: {
range() {
return this.max - this.min;
}
},
},
created() {
@@ -131,13 +131,13 @@ export default createComponent({
return (
Math.round(Math.max(this.min, Math.min(value, this.max)) / this.step) * this.step
);
}
},
},
render() {
const { vertical } = this;
const style = {
background: this.inactiveColor
background: this.inactiveColor,
};
const mainAxis = vertical ? 'height' : 'width';
@@ -146,7 +146,7 @@ export default createComponent({
const barStyle = {
[mainAxis]: `${((this.value - this.min) * 100) / this.range}%`,
[crossAxis]: addUnit(this.barHeight),
background: this.activeColor
background: this.activeColor,
};
if (this.dragStatus) {
@@ -175,5 +175,5 @@ export default createComponent({
</div>
</div>
);
}
},
});
+18 -18
View File
@@ -3,7 +3,7 @@ import {
mount,
trigger,
triggerDrag,
mockGetBoundingClientRect
mockGetBoundingClientRect,
} from '../../../test';
function mockRect(vertical) {
@@ -11,7 +11,7 @@ function mockRect(vertical) {
width: vertical ? 0 : 100,
height: vertical ? 100 : 0,
top: vertical ? 0 : 100,
left: vertical ? 100 : 0
left: vertical ? 100 : 0,
});
}
@@ -21,8 +21,8 @@ test('drag button', () => {
const wrapper = mount(Slider, {
propsData: {
value: 50,
disabled: true
}
disabled: true,
},
});
wrapper.vm.$on('input', value => {
@@ -52,8 +52,8 @@ it('click bar', () => {
const wrapper = mount(Slider, {
propsData: {
value: 50,
disabled: true
}
disabled: true,
},
});
wrapper.vm.$on('input', value => {
@@ -76,8 +76,8 @@ test('drag button vertical', () => {
const wrapper = mount(Slider, {
propsData: {
value: 50,
vertical: true
}
vertical: true,
},
});
wrapper.vm.$on('input', value => {
@@ -97,8 +97,8 @@ it('click vertical', () => {
const wrapper = mount(Slider, {
propsData: {
value: 50,
vertical: true
}
vertical: true,
},
});
wrapper.vm.$on('input', value => {
@@ -115,8 +115,8 @@ it('bar height', () => {
const wrapper = mount(Slider, {
propsData: {
value: 50,
barHeight: 10
}
barHeight: 10,
},
});
expect(wrapper).toMatchSnapshot();
@@ -125,13 +125,13 @@ it('bar height', () => {
it('should not emit change event when value not changed', () => {
const wrapper = mount(Slider, {
propsData: {
value: 50
value: 50,
},
listeners: {
input(value) {
wrapper.setProps({ value });
}
}
},
},
});
trigger(wrapper, 'click', 100, 0);
@@ -143,13 +143,13 @@ it('should not emit change event when value not changed', () => {
it('should format initial value', done => {
mount(Slider, {
propsData: {
value: null
value: null,
},
listeners: {
input(value) {
expect(value).toEqual(0);
done();
}
}
},
},
});
});