chore: bump prettier v3 and format all code (#12111)

* chore: bump prettier v3 and format all code

* chore: mjs config

* chore: revert

* chore: revert

* chore: update lock
This commit is contained in:
neverland
2023-07-22 14:14:14 +08:00
committed by GitHub
parent b601ca1e0b
commit 3dcc92a5c0
209 changed files with 565 additions and 543 deletions
+6 -6
View File
@@ -49,7 +49,7 @@ export default defineComponent({
const createBarrageItem = (
text: string | number,
delay: number = props.delay
delay: number = props.delay,
) => {
const item = document.createElement('span');
item.className = className;
@@ -69,7 +69,7 @@ export default defineComponent({
const appendBarrageItem = ({ id, text }: BarrageItem, i: number) => {
const item = createBarrageItem(
text,
isInitBarrage.value ? i * props.delay : undefined
isInitBarrage.value ? i * props.delay : undefined,
);
if (!props.autoPlay && isPlay.value === false) {
item.style.animationPlayState = 'paused';
@@ -86,14 +86,14 @@ export default defineComponent({
item.addEventListener('animationend', () => {
emit(
'update:modelValue',
[...props.modelValue].filter((v) => String(v.id) !== item.dataset.id)
[...props.modelValue].filter((v) => String(v.id) !== item.dataset.id),
);
});
};
const updateBarrages = (
newValue: BarrageItem[],
oldValue: BarrageItem[]
oldValue: BarrageItem[],
) => {
const map = new Map(oldValue.map((item) => [item.id, item]));
@@ -109,7 +109,7 @@ export default defineComponent({
map.forEach((item) => {
// remove
const index = barrageItems.findIndex(
(span) => span.dataset.id === String(item.id)
(span) => span.dataset.id === String(item.id),
);
if (index > -1) {
barrageItems[index].remove();
@@ -123,7 +123,7 @@ export default defineComponent({
watch(
() => props.modelValue.slice(),
(newValue, oldValue) => updateBarrages(newValue ?? [], oldValue ?? []),
{ deep: true }
{ deep: true },
);
const rootStyle = ref<{
+4 -1
View File
@@ -21,7 +21,10 @@
font-weight: bold;
white-space: nowrap;
color: var(--van-barrage-color);
text-shadow: 1px 0 1px #000000, 0 1px 1px #000000, 0 -1px 1px #000000,
text-shadow:
1px 0 1px #000000,
0 1px 1px #000000,
0 -1px 1px #000000,
-1px 0 1px #000000;
user-select: none;
will-change: transform;
@@ -59,21 +59,21 @@ test('should not auto play use play function when use play function', async () =
expect(
(wrapper.find('.van-barrage__item') as HTMLSpanElement).style
.animationPlayState
.animationPlayState,
).toBe('paused');
barrage.value?.play();
expect(
(wrapper.find('.van-barrage__item') as HTMLSpanElement).style
.animationPlayState
.animationPlayState,
).toBe('running');
barrage.value?.pause();
expect(
(wrapper.find('.van-barrage__item') as HTMLSpanElement).style
.animationPlayState
.animationPlayState,
).toBe('paused');
});
@@ -110,7 +110,7 @@ test('should emit "update:modelValue" when animationend', async () => {
expect(
(wrapper.find('.van-barrage__item') as HTMLSpanElement).style
.animationPlayState
.animationPlayState,
).toBe('running');
await wrapper.setProps({
@@ -130,7 +130,7 @@ test('should emit "update:modelValue" when animationend', async () => {
await trigger(
wrapper.find('.van-barrage__item') as HTMLSpanElement,
'animationend'
'animationend',
);
expect(wrapper.emitted('change')?.[0][0]).toEqual([