mirror of
https://github.com/youzan/vant.git
synced 2025-10-22 11:54:02 +00:00
chore: add trailingComma
This commit is contained in:
@@ -55,13 +55,13 @@ export default {
|
||||
option1: [
|
||||
{ text: '全部商品', value: 0 },
|
||||
{ text: '新款商品', value: 1 },
|
||||
{ text: '活动商品', value: 2 }
|
||||
{ text: '活动商品', value: 2 },
|
||||
],
|
||||
option2: [
|
||||
{ text: '默认排序', value: 'a' },
|
||||
{ text: '好评排序', value: 'b' },
|
||||
{ text: '销量排序', value: 'c' }
|
||||
]
|
||||
{ text: '销量排序', value: 'c' },
|
||||
],
|
||||
},
|
||||
'en-US': {
|
||||
disableMenu: 'Disable Menu',
|
||||
@@ -74,14 +74,14 @@ export default {
|
||||
option1: [
|
||||
{ text: 'Option1', value: 0 },
|
||||
{ text: 'Option2', value: 1 },
|
||||
{ text: 'Option3', value: 2 }
|
||||
{ text: 'Option3', value: 2 },
|
||||
],
|
||||
option2: [
|
||||
{ text: 'Option A', value: 'a' },
|
||||
{ text: 'Option B', value: 'b' },
|
||||
{ text: 'Option C', value: 'c' }
|
||||
]
|
||||
}
|
||||
{ text: 'Option C', value: 'c' },
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
@@ -89,7 +89,7 @@ export default {
|
||||
switch1: true,
|
||||
switch2: false,
|
||||
value1: 0,
|
||||
value2: 'a'
|
||||
value2: 'a',
|
||||
};
|
||||
},
|
||||
|
||||
@@ -100,13 +100,13 @@ export default {
|
||||
|
||||
option2() {
|
||||
return this.$t('option2');
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
onConfirm() {
|
||||
this.$refs.item.toggle();
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@@ -11,44 +11,44 @@ export default createComponent({
|
||||
ParentMixin('vanDropdownMenu'),
|
||||
ClickOutsideMixin({
|
||||
event: 'click',
|
||||
method: 'onClickOutside'
|
||||
})
|
||||
method: 'onClickOutside',
|
||||
}),
|
||||
],
|
||||
|
||||
props: {
|
||||
activeColor: String,
|
||||
overlay: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
zIndex: {
|
||||
type: Number,
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
duration: {
|
||||
type: Number,
|
||||
default: 0.2
|
||||
default: 0.2,
|
||||
},
|
||||
direction: {
|
||||
type: String,
|
||||
default: 'down'
|
||||
default: 'down',
|
||||
},
|
||||
closeOnClickOverlay: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
offset: 0
|
||||
offset: 0,
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
scroller() {
|
||||
return getScroller(this.$el);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
@@ -77,7 +77,7 @@ export default createComponent({
|
||||
this.children.forEach(item => {
|
||||
item.toggle(false);
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
render() {
|
||||
@@ -96,9 +96,9 @@ export default createComponent({
|
||||
class={[
|
||||
bem('title', {
|
||||
active: item.showPopup,
|
||||
down: item.showPopup === (this.direction === 'down')
|
||||
down: item.showPopup === (this.direction === 'down'),
|
||||
}),
|
||||
item.titleClass
|
||||
item.titleClass,
|
||||
]}
|
||||
style={{ color: item.showPopup ? this.activeColor : '' }}
|
||||
>
|
||||
@@ -113,5 +113,5 @@ export default createComponent({
|
||||
{this.slots('default')}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
@@ -16,10 +16,10 @@ function renderWrapper(options = {}) {
|
||||
closeOnClickOutside: options.closeOnClickOutside,
|
||||
options: [
|
||||
{ text: 'A', value: 0, icon: options.icon },
|
||||
{ text: 'B', value: 1, icon: options.icon }
|
||||
]
|
||||
{ text: 'B', value: 1, icon: options.icon },
|
||||
],
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ test('show dropdown item', async () => {
|
||||
|
||||
test('render option icon', async () => {
|
||||
const wrapper = renderWrapper({
|
||||
icon: 'success'
|
||||
icon: 'success',
|
||||
});
|
||||
|
||||
await later();
|
||||
@@ -55,7 +55,7 @@ test('render option icon', async () => {
|
||||
|
||||
test('close-on-click-outside', async () => {
|
||||
const wrapper = renderWrapper({
|
||||
closeOnClickOutside: true
|
||||
closeOnClickOutside: true,
|
||||
});
|
||||
|
||||
await later();
|
||||
@@ -69,7 +69,7 @@ test('close-on-click-outside', async () => {
|
||||
|
||||
test('disable close-on-click-outside', async () => {
|
||||
const wrapper = renderWrapper({
|
||||
closeOnClickOutside: false
|
||||
closeOnClickOutside: false,
|
||||
});
|
||||
|
||||
await later();
|
||||
@@ -86,7 +86,7 @@ test('direction up', async () => {
|
||||
window.innerHeight = 1000;
|
||||
|
||||
const wrapper = renderWrapper({
|
||||
direction: 'up'
|
||||
direction: 'up',
|
||||
});
|
||||
|
||||
await later();
|
||||
@@ -140,10 +140,10 @@ test('destroy one item', async () => {
|
||||
render: true,
|
||||
options: [
|
||||
{ text: 'A', value: 0 },
|
||||
{ text: 'B', value: 1 }
|
||||
]
|
||||
{ text: 'B', value: 1 },
|
||||
],
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
await later();
|
||||
@@ -163,10 +163,10 @@ test('disable dropdown item', async () => {
|
||||
value: 0,
|
||||
options: [
|
||||
{ text: 'A', value: 0 },
|
||||
{ text: 'B', value: 1 }
|
||||
]
|
||||
{ text: 'B', value: 1 },
|
||||
],
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const title = wrapper.find('.van-dropdown-menu__title');
|
||||
@@ -189,13 +189,13 @@ test('change event', async () => {
|
||||
value: 0,
|
||||
options: [
|
||||
{ text: 'A', value: 0 },
|
||||
{ text: 'B', value: 1 }
|
||||
]
|
||||
{ text: 'B', value: 1 },
|
||||
],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
onChange
|
||||
}
|
||||
onChange,
|
||||
},
|
||||
});
|
||||
|
||||
await later();
|
||||
@@ -232,7 +232,7 @@ test('toggle method', async done => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
|
||||
done();
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -246,7 +246,7 @@ test('title slot', () => {
|
||||
</template>
|
||||
</van-dropdown-item>
|
||||
</van-dropdown-menu>
|
||||
`
|
||||
`,
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
|
Reference in New Issue
Block a user