From 6d393bbcb35a3d2c81c7b45b05c4277b30500d76 Mon Sep 17 00:00:00 2001 From: Eiinu Date: Tue, 29 Aug 2023 17:03:41 +0800 Subject: [PATCH] chore: format event name to camelcase (#2487) --- src/packages/__VUE/address/index.taro.vue | 6 ++--- src/packages/__VUE/address/index.vue | 6 ++--- src/packages/__VUE/audio/index.vue | 4 ++-- .../countdown/__tests__/countdown.spec.ts | 4 ++-- src/packages/__VUE/countdown/index.taro.vue | 10 ++++---- src/packages/__VUE/countdown/index.vue | 10 ++++---- src/packages/__VUE/countup/index.taro.vue | 14 +++++------ src/packages/__VUE/countup/index.vue | 14 +++++------ .../__VUE/elevator/__tests__/index.spec.ts | 4 ++-- src/packages/__VUE/elevator/index.taro.vue | 6 ++--- src/packages/__VUE/elevator/index.vue | 6 ++--- src/packages/__VUE/formitem/index.taro.vue | 2 -- src/packages/__VUE/formitem/index.vue | 2 -- src/packages/__VUE/infiniteloading/index.vue | 6 ++--- src/packages/__VUE/input/index.taro.vue | 4 ++-- src/packages/__VUE/input/index.vue | 4 ++-- src/packages/__VUE/invoice/index.taro.vue | 2 +- src/packages/__VUE/invoice/index.vue | 2 +- src/packages/__VUE/list/index.taro.vue | 6 ++--- src/packages/__VUE/list/index.vue | 6 ++--- .../__VUE/navbar/__test__/navbar.spec.ts | 8 +++---- src/packages/__VUE/navbar/index.taro.vue | 10 ++++---- src/packages/__VUE/navbar/index.vue | 10 ++++---- .../noticebar/__tests__/noticebar.spec.ts | 2 +- src/packages/__VUE/noticebar/index.taro.vue | 4 ++-- src/packages/__VUE/noticebar/index.vue | 4 ++-- .../__VUE/popup/__tests__/popup.spec.ts | 8 +++---- src/packages/__VUE/popup/index.taro.vue | 8 +++---- src/packages/__VUE/popup/index.vue | 8 +++---- src/packages/__VUE/range/index.taro.vue | 6 ++--- src/packages/__VUE/range/index.vue | 6 ++--- src/packages/__VUE/row/index.taro.vue | 1 - src/packages/__VUE/row/index.vue | 1 - src/packages/__VUE/searchbar/index.taro.vue | 12 +++++----- src/packages/__VUE/searchbar/index.vue | 12 +++++----- src/packages/__VUE/sidenavbar/index.taro.vue | 1 - src/packages/__VUE/sidenavbar/index.vue | 1 - src/packages/__VUE/sku/__tests__/sku.spec.ts | 4 ++-- .../__VUE/sku/components/SkuHeader.taro.vue | 1 - src/packages/__VUE/sku/index.taro.vue | 24 +++++++++---------- src/packages/__VUE/sku/index.vue | 24 +++++++++---------- src/packages/__VUE/step/index.taro.vue | 2 +- src/packages/__VUE/step/index.vue | 2 +- src/packages/__VUE/steps/index.taro.vue | 4 ++-- src/packages/__VUE/steps/index.vue | 4 ++-- .../__VUE/subsidenavbar/index.taro.vue | 4 ++-- src/packages/__VUE/subsidenavbar/index.vue | 4 ++-- src/packages/__VUE/tabbar/index.taro.vue | 4 ++-- src/packages/__VUE/tabbar/index.vue | 4 ++-- .../__VUE/uploader/__tests__/index.spec.ts | 2 +- src/packages/__VUE/uploader/index.taro.vue | 4 ++-- src/packages/__VUE/uploader/index.vue | 4 ++-- 52 files changed, 151 insertions(+), 160 deletions(-) diff --git a/src/packages/__VUE/address/index.taro.vue b/src/packages/__VUE/address/index.taro.vue index fc30bd9192..a05db26b87 100644 --- a/src/packages/__VUE/address/index.taro.vue +++ b/src/packages/__VUE/address/index.taro.vue @@ -209,7 +209,7 @@ export default create({ default: '' } }, - emits: ['update:visible', 'update:modelValue', 'type', 'change', 'selected', 'close', 'close-mask', 'switch-module'], + emits: ['update:visible', 'update:modelValue', 'type', 'change', 'selected', 'close', 'closeMask', 'switchModule'], setup(props, { emit }) { const classes = computed(() => { @@ -439,7 +439,7 @@ export default create({ if (closeWay.value == 'self') { emit('close', callBackParams); } else { - emit('close-mask', { closeWay: closeWay }); + emit('closeMask', { closeWay: closeWay }); } emit('update:visible', false); @@ -450,7 +450,7 @@ export default create({ const type = privateType.value; privateType.value = type == 'exist' ? 'custom' : 'exist'; initAddress(); - emit('switch-module', { type: privateType.value }); + emit('switchModule', { type: privateType.value }); }; const handleElevatorItem = (key: string, item: RegionData) => { diff --git a/src/packages/__VUE/address/index.vue b/src/packages/__VUE/address/index.vue index 19ddffe85b..5d03c577a9 100644 --- a/src/packages/__VUE/address/index.vue +++ b/src/packages/__VUE/address/index.vue @@ -195,7 +195,7 @@ export default create({ default: '' } }, - emits: ['update:visible', 'update:modelValue', 'type', 'change', 'selected', 'close', 'close-mask', 'switch-module'], + emits: ['update:visible', 'update:modelValue', 'type', 'change', 'selected', 'close', 'closeMask', 'switchModule'], setup(props: any, { emit }) { const regionLine = ref(null); @@ -424,7 +424,7 @@ export default create({ if (closeWay.value == 'self') { emit('close', callBackParams); } else { - emit('close-mask', { closeWay: closeWay }); + emit('closeMask', { closeWay: closeWay }); } emit('update:visible', false); @@ -435,7 +435,7 @@ export default create({ const type = privateType.value; privateType.value = type == 'exist' ? 'custom' : 'exist'; initAddress(); - emit('switch-module', { type: privateType.value }); + emit('switchModule', { type: privateType.value }); }; const handleElevatorItem = (key: string, item: RegionData) => { diff --git a/src/packages/__VUE/audio/index.vue b/src/packages/__VUE/audio/index.vue index 9db79418c8..88ff3bbbef 100644 --- a/src/packages/__VUE/audio/index.vue +++ b/src/packages/__VUE/audio/index.vue @@ -110,7 +110,7 @@ export default create({ Service, [Range.name]: Range as Component }, - emits: ['fastBack', 'play', 'forward', 'ended', 'changeProgress', 'mute', 'can-play'], + emits: ['fastBack', 'play', 'forward', 'ended', 'changeProgress', 'mute', 'canPlay'], setup(props, { emit, slots }) { const audioRef = ref(null); @@ -165,7 +165,7 @@ export default create({ audioData.second = audioR.duration; audioData.duration = formatSeconds(audioR.duration); - emit('can-play', e); + emit('canPlay', e); }; //播放时间 diff --git a/src/packages/__VUE/countdown/__tests__/countdown.spec.ts b/src/packages/__VUE/countdown/__tests__/countdown.spec.ts index eb87f11fc7..807ca6f79a 100644 --- a/src/packages/__VUE/countdown/__tests__/countdown.spec.ts +++ b/src/packages/__VUE/countdown/__tests__/countdown.spec.ts @@ -10,9 +10,9 @@ test('endTime props', async () => { endTime: Date.now() + 1 * 50 } }); - expect(wrapper.emitted('on-end')).toBeFalsy(); + expect(wrapper.emitted('onEnd')).toBeFalsy(); await sleep(51); - expect(wrapper.emitted('on-end')).toBeTruthy(); + expect(wrapper.emitted('onEnd')).toBeTruthy(); }); test('format props', async () => { diff --git a/src/packages/__VUE/countdown/index.taro.vue b/src/packages/__VUE/countdown/index.taro.vue index 12ec6eb53e..81ac5d503a 100644 --- a/src/packages/__VUE/countdown/index.taro.vue +++ b/src/packages/__VUE/countdown/index.taro.vue @@ -64,7 +64,7 @@ export default create({ default: 0 } }, - emits: ['input', 'on-end', 'on-restart', 'on-paused', 'update:modelValue'], + emits: ['input', 'onEnd', 'onRestart', 'onPaused', 'update:modelValue'], setup(props: any, { emit, slots }) { const state = reactive({ @@ -106,7 +106,7 @@ export default create({ if (!remainTime) { state.counting = false; pause(); - emit('on-end'); + emit('onEnd'); } if (remainTime > 0) { @@ -192,14 +192,14 @@ export default create({ state.counting = true; state.handleEndTime = Date.now() + Number(state.restTime); tick(); - emit('on-restart', state.restTime); + emit('onRestart', state.restTime); } }; // 暂定 const pause = () => { cancelAnimationFrame(state.timer as any); state.counting = false; - emit('on-paused', state.restTime); + emit('onPaused', state.restTime); }; //重置 @@ -240,7 +240,7 @@ export default create({ state.handleEndTime = Date.now() + Number(state.restTime); tick(); } - emit('on-restart', state.restTime); + emit('onRestart', state.restTime); } } ); diff --git a/src/packages/__VUE/countdown/index.vue b/src/packages/__VUE/countdown/index.vue index 03d4f0030a..50aea4b414 100644 --- a/src/packages/__VUE/countdown/index.vue +++ b/src/packages/__VUE/countdown/index.vue @@ -63,7 +63,7 @@ export default create({ default: 0 } }, - emits: ['input', 'on-end', 'on-restart', 'on-paused', 'update:modelValue'], + emits: ['input', 'onEnd', 'onRestart', 'onPaused', 'update:modelValue'], setup(props: any, { emit, slots }) { const state = reactive({ @@ -105,7 +105,7 @@ export default create({ if (!remainTime) { state.counting = false; pause(); - emit('on-end'); + emit('onEnd'); } if (remainTime > 0) { @@ -191,14 +191,14 @@ export default create({ state.counting = true; state.handleEndTime = Date.now() + Number(state.restTime); tick(); - emit('on-restart', state.restTime); + emit('onRestart', state.restTime); } }; // 暂定 const pause = () => { cancelAnimationFrame(state.timer as any); state.counting = false; - emit('on-paused', state.restTime); + emit('onPaused', state.restTime); }; //重置 @@ -239,7 +239,7 @@ export default create({ state.handleEndTime = Date.now() + Number(state.restTime); tick(); } - emit('on-restart', state.restTime); + emit('onRestart', state.restTime); } } ); diff --git a/src/packages/__VUE/countup/index.taro.vue b/src/packages/__VUE/countup/index.taro.vue index 62985ac90d..d3875e728d 100644 --- a/src/packages/__VUE/countup/index.taro.vue +++ b/src/packages/__VUE/countup/index.taro.vue @@ -212,7 +212,7 @@ export default create({ } }, components: {}, - emits: ['click', 'scroll-end'], + emits: ['click', 'scrollEnd'], setup(props, { emit }) { const data: IData = reactive({ valFlag: false, @@ -347,7 +347,7 @@ export default create({ //数字减小,有可能导致current小于speed data.current = Number(endNum.toFixed(toFixed)); clearInterval(countTimer); - emit('scroll-end'); + emit('scrollEnd'); data.valFlag = false; } else { data.current = Number((parseFloat(String(data.current)) - parseFloat(String(speed))).toFixed(toFixed)); @@ -357,7 +357,7 @@ export default create({ if (data.current >= endNum) { data.current = Number(endNum.toFixed(toFixed)); clearInterval(countTimer); - emit('scroll-end'); + emit('scrollEnd'); data.valFlag = false; } else { data.current = Number((parseFloat(String(data.current)) + parseFloat(String(speed))).toFixed(toFixed)); @@ -475,7 +475,7 @@ export default create({ // that.totalCount--; if (data.totalCount <= 0) { clearIntervalTime(); - emit('scroll-end'); + emit('scrollEnd'); data.valFlag = false; } }, props.during); @@ -535,7 +535,7 @@ export default create({ // data.relNum = calculation(data.relNum, m * props.speed, '+'); // }, props.during); f.addEventListener('webkitTransitionEnd', () => { - emit('scroll-end'); + emit('scrollEnd'); data.valFlag = false; // setTimeout(() => { // data.relNum = calculation(data.relNum, m * props.speed, '+'); @@ -611,10 +611,10 @@ export default create({ setTimeout(() => { data.finshMachine = 0; if (data.prizeLevelTrun < 0) { - emit('scroll-end', false); + emit('scrollEnd', false); data.valFlag = false; } else { - emit('scroll-end', true); + emit('scrollEnd', true); data.valFlag = false; } }, 130); diff --git a/src/packages/__VUE/countup/index.vue b/src/packages/__VUE/countup/index.vue index 327fbae62e..f845d3425e 100644 --- a/src/packages/__VUE/countup/index.vue +++ b/src/packages/__VUE/countup/index.vue @@ -212,7 +212,7 @@ export default create({ } }, components: {}, - emits: ['click', 'scroll-end'], + emits: ['click', 'scrollEnd'], setup(props, { emit }) { const runNumberImg = ref(null); const numberItemRef = ref([]); @@ -354,7 +354,7 @@ export default create({ //数字减小,有可能导致current小于speed data.current = endNum.toFixed(toFixed); clearInterval(countTimer); - emit('scroll-end'); + emit('scrollEnd'); data.valFlag = false; } else { let num = parseFloat(String(data.current)) - parseFloat(String(speed)); @@ -365,7 +365,7 @@ export default create({ if (Number(data.current) >= endNum) { data.current = endNum.toFixed(toFixed); clearInterval(countTimer); - emit('scroll-end'); + emit('scrollEnd'); data.valFlag = false; } else { let num = parseFloat(String(data.current)) + parseFloat(String(speed)); @@ -484,7 +484,7 @@ export default create({ // that.totalCount--; if (data.totalCount <= 0) { clearIntervalTime(); - emit('scroll-end'); + emit('scrollEnd'); data.valFlag = false; } }, props.during); @@ -551,7 +551,7 @@ export default create({ // data.relNum = calculation(data.relNum, m * props.speed, '+'); // }, props.during); (runNumberImg.value as any).addEventListener('webkitTransitionEnd', () => { - emit('scroll-end'); + emit('scrollEnd'); data.valFlag = false; // setTimeout(() => { // data.relNum = calculation(data.relNum, m * props.speed, '+'); @@ -626,10 +626,10 @@ export default create({ setTimeout(() => { data.finshMachine = 0; if (data.prizeLevelTrun < 0) { - emit('scroll-end', false); + emit('scrollEnd', false); data.valFlag = false; } else { - emit('scroll-end', true); + emit('scrollEnd', true); data.valFlag = false; } }, 130); diff --git a/src/packages/__VUE/elevator/__tests__/index.spec.ts b/src/packages/__VUE/elevator/__tests__/index.spec.ts index 1ab249f64b..13c5ee43ed 100644 --- a/src/packages/__VUE/elevator/__tests__/index.spec.ts +++ b/src/packages/__VUE/elevator/__tests__/index.spec.ts @@ -84,7 +84,7 @@ test('should list item highlight when clickItem trigger click', async () => { 'nut-elevator__list__item__name--highcolor' ); - expect((wrapper.emitted('click-item') as any)[0][0]).toBe('B'); + expect((wrapper.emitted('clickItem') as any)[0][0]).toBe('B'); }); test('clickIndex trigger click', async () => { @@ -97,7 +97,7 @@ test('clickIndex trigger click', async () => { const listItem = wrapper.findAll('.nut-elevator__bars__inner__item')[2]; await listItem.trigger('click'); - expect((wrapper.emitted('click-index') as any)[0][0]).toBe('G'); + expect((wrapper.emitted('clickIndex') as any)[0][0]).toBe('G'); }); test('index is sticky', async () => { diff --git a/src/packages/__VUE/elevator/index.taro.vue b/src/packages/__VUE/elevator/index.taro.vue index 8fe81b755b..d794f0d8fa 100644 --- a/src/packages/__VUE/elevator/index.taro.vue +++ b/src/packages/__VUE/elevator/index.taro.vue @@ -96,7 +96,7 @@ export default create({ default: 35 } }, - emits: ['click-item', 'click-index', 'change'], + emits: ['clickItem', 'clickIndex', 'change'], setup(props, context) { const spaceHeight = 23; const listview: Ref = ref() as Ref; @@ -196,13 +196,13 @@ export default create({ }; const handleClickItem = (key: string, item: ElevatorData) => { - context.emit('click-item', key, item); + context.emit('clickItem', key, item); state.currentData = item; state.currentKey = key; }; const handleClickIndex = (key: string) => { - context.emit('click-index', key); + context.emit('clickIndex', key); }; const listViewScroll = (e: Event) => { diff --git a/src/packages/__VUE/elevator/index.vue b/src/packages/__VUE/elevator/index.vue index 0243ca53ae..f6267aeb3e 100644 --- a/src/packages/__VUE/elevator/index.vue +++ b/src/packages/__VUE/elevator/index.vue @@ -74,7 +74,7 @@ export default create({ default: 35 } }, - emits: ['click-item', 'click-index', 'change'], + emits: ['clickItem', 'clickIndex', 'change'], setup(props, context) { const listview: Ref = ref(null); const state = reactive({ @@ -168,13 +168,13 @@ export default create({ }; const handleClickItem = (key: string, item: ElevatorData) => { - context.emit('click-item', key, item); + context.emit('clickItem', key, item); state.currentData = item; state.currentKey = key; }; const handleClickIndex = (key: string) => { - context.emit('click-index', key); + context.emit('clickIndex', key); }; const listViewScroll = (e: Event) => { diff --git a/src/packages/__VUE/formitem/index.taro.vue b/src/packages/__VUE/formitem/index.taro.vue index e5bd58ec2f..c9c401fef0 100644 --- a/src/packages/__VUE/formitem/index.taro.vue +++ b/src/packages/__VUE/formitem/index.taro.vue @@ -76,8 +76,6 @@ export default create({ components: { [Cell.name]: Cell }, - emits: [''], - setup(props, { slots }) { const parent = inject('formErrorTip') as any; provide('form', { diff --git a/src/packages/__VUE/formitem/index.vue b/src/packages/__VUE/formitem/index.vue index ea1570162e..3f432ea859 100644 --- a/src/packages/__VUE/formitem/index.vue +++ b/src/packages/__VUE/formitem/index.vue @@ -76,8 +76,6 @@ export default create({ components: { [Cell.name]: Cell }, - emits: [''], - setup(props, { slots }) { const parent = inject('formErrorTip') as any; provide('form', { diff --git a/src/packages/__VUE/infiniteloading/index.vue b/src/packages/__VUE/infiniteloading/index.vue index a5268844eb..e372fedf4e 100644 --- a/src/packages/__VUE/infiniteloading/index.vue +++ b/src/packages/__VUE/infiniteloading/index.vue @@ -68,7 +68,7 @@ export default create({ default: false } }, - emits: ['scroll-change', 'load-more', 'update:modelValue'], + emits: ['scrollChange', 'loadMore', 'update:modelValue'], components: { Loading }, @@ -123,7 +123,7 @@ export default create({ state.beforeScrollTop = resScrollTop; - emit('scroll-change', resScrollTop); + emit('scrollChange', resScrollTop); return offsetDistance <= props.threshold && direction == 'down'; }; @@ -135,7 +135,7 @@ export default create({ } else { state.isInfiniting = true; emit('update:modelValue', true); - nextTick(() => emit('load-more')); + nextTick(() => emit('loadMore')); } }); }; diff --git a/src/packages/__VUE/input/index.taro.vue b/src/packages/__VUE/input/index.taro.vue index 941f0e3738..513b2d43ac 100644 --- a/src/packages/__VUE/input/index.taro.vue +++ b/src/packages/__VUE/input/index.taro.vue @@ -163,7 +163,7 @@ export default create({ } }, components: { MaskClose }, - emits: ['update:modelValue', 'blur', 'focus', 'clear', 'keypress', 'click', 'click-input'], + emits: ['update:modelValue', 'blur', 'focus', 'clear', 'keypress', 'click', 'clickInput'], setup(props, { emit }) { const active = ref(false); @@ -300,7 +300,7 @@ export default create({ if (props.disabled) { return; } - emit('click-input', event); + emit('clickInput', event); }; const onClick = (event: MouseEvent) => { diff --git a/src/packages/__VUE/input/index.vue b/src/packages/__VUE/input/index.vue index 95273372f1..b07b48efdf 100644 --- a/src/packages/__VUE/input/index.vue +++ b/src/packages/__VUE/input/index.vue @@ -151,7 +151,7 @@ export default create({ }, components: { MaskClose }, - emits: ['update:modelValue', 'blur', 'focus', 'clear', 'keypress', 'click', 'click-input'], + emits: ['update:modelValue', 'blur', 'focus', 'clear', 'keypress', 'click', 'clickInput'], expose: ['focus', 'blur', 'select'], setup(props, { emit }) { @@ -285,7 +285,7 @@ export default create({ if (props.disabled) { return; } - emit('click-input', event); + emit('clickInput', event); }; const onClick = (event: MouseEvent) => { diff --git a/src/packages/__VUE/invoice/index.taro.vue b/src/packages/__VUE/invoice/index.taro.vue index bd3a874e54..1d6e9ccb3f 100644 --- a/src/packages/__VUE/invoice/index.taro.vue +++ b/src/packages/__VUE/invoice/index.taro.vue @@ -67,7 +67,7 @@ export default create({ default: true } }, - emits: ['onSubmit', 'scroll-bottom'], + emits: ['onSubmit', 'scrollBottom'], setup(props, { emit }) { const formRef = ref(); diff --git a/src/packages/__VUE/invoice/index.vue b/src/packages/__VUE/invoice/index.vue index deac88a47b..fd91fd763d 100644 --- a/src/packages/__VUE/invoice/index.vue +++ b/src/packages/__VUE/invoice/index.vue @@ -67,7 +67,7 @@ export default create({ default: true } }, - emits: ['onSubmit', 'scroll-bottom'], + emits: ['onSubmit', 'scrollBottom'], setup(props, { emit }) { const formRef = ref(); diff --git a/src/packages/__VUE/list/index.taro.vue b/src/packages/__VUE/list/index.taro.vue index e666dec65b..c6dfd7f835 100644 --- a/src/packages/__VUE/list/index.taro.vue +++ b/src/packages/__VUE/list/index.taro.vue @@ -73,7 +73,7 @@ export default create({ default: 10 } }, - emits: ['scroll-up', 'scroll-down', 'scroll-bottom'], + emits: ['scrollUp', 'scrollDown', 'scrollBottom'], setup(props, { emit }) { const list = ref(null) as Ref; @@ -227,10 +227,10 @@ export default create({ state.originStartIndex = currentIndex; state.start = Math.max(state.originStartIndex - props.bufferSize, 0); if (end.value >= state.list.length - 1) { - emit('scroll-bottom'); + emit('scrollBottom'); } } - emit(scrollTop > state.scrollTop ? 'scroll-up' : 'scroll-down', scrollTop); + emit(scrollTop > state.scrollTop ? 'scrollUp' : 'scrollDown', scrollTop); state.scrollTop = scrollTop; }; diff --git a/src/packages/__VUE/list/index.vue b/src/packages/__VUE/list/index.vue index 60b5d8237c..854a708f9d 100644 --- a/src/packages/__VUE/list/index.vue +++ b/src/packages/__VUE/list/index.vue @@ -41,7 +41,7 @@ export default create({ default: 10 } }, - emits: ['scroll-up', 'scroll-down', 'scroll-bottom'], + emits: ['scrollUp', 'scrollDown', 'scrollBottom'], setup(props, { emit }) { const list = ref(null) as Ref; @@ -186,10 +186,10 @@ export default create({ state.originStartIndex = currentIndex; state.start = Math.max(state.originStartIndex - props.bufferSize, 0); if (end.value >= state.list.length - 1) { - emit('scroll-bottom'); + emit('scrollBottom'); } } - emit(scrollTop > state.scrollTop ? 'scroll-up' : 'scroll-down', scrollTop); + emit(scrollTop > state.scrollTop ? 'scrollUp' : 'scrollDown', scrollTop); state.scrollTop = scrollTop; }; diff --git a/src/packages/__VUE/navbar/__test__/navbar.spec.ts b/src/packages/__VUE/navbar/__test__/navbar.spec.ts index 8545aac353..5b97f0b079 100644 --- a/src/packages/__VUE/navbar/__test__/navbar.spec.ts +++ b/src/packages/__VUE/navbar/__test__/navbar.spec.ts @@ -48,13 +48,13 @@ test('Navbar: emit click-left & click-right', () => { }); wrapper.find('.nut-navbar__left').trigger('click'); - expect(wrapper.emitted('on-click-back')).toBeTruthy(); + expect(wrapper.emitted('onClickBack')).toBeTruthy(); wrapper.find('.nut-navbar__right').trigger('click'); - expect(wrapper.emitted('on-click-right')).toBeTruthy(); + expect(wrapper.emitted('onClickRight')).toBeTruthy(); wrapper.find('.nut-navbar__title .title').trigger('click'); - expect(wrapper.emitted('on-click-title')).toBeTruthy(); + expect(wrapper.emitted('onClickTitle')).toBeTruthy(); wrapper.find('.nut-navbar__title .icon').trigger('click'); - expect(wrapper.emitted('on-click-icon')).toBeTruthy(); + expect(wrapper.emitted('onClickIcon')).toBeTruthy(); }); test('Navbar: should change z-index when using z-index prop', async () => { diff --git a/src/packages/__VUE/navbar/index.taro.vue b/src/packages/__VUE/navbar/index.taro.vue index 6edbe0bbfd..90a9580d88 100644 --- a/src/packages/__VUE/navbar/index.taro.vue +++ b/src/packages/__VUE/navbar/index.taro.vue @@ -59,7 +59,7 @@ export default create({ default: 10 } }, - emits: ['on-click-back', 'on-click-title', 'on-click-icon', 'on-click-right'], + emits: ['onClickBack', 'onClickTitle', 'onClickIcon', 'onClickRight'], setup(props, { emit }) { const { border, fixed, safeAreaInsetTop, placeholder } = toRefs(props); const refRandomId = Math.random().toString(36).slice(-8); @@ -102,19 +102,19 @@ export default create({ }); const handleLeft = () => { - emit('on-click-back'); + emit('onClickBack'); }; const handleCenter = () => { - emit('on-click-title'); + emit('onClickTitle'); }; const handleCenterIcon = () => { - emit('on-click-icon'); + emit('onClickIcon'); }; const handleRight = () => { - emit('on-click-right'); + emit('onClickRight'); }; return { diff --git a/src/packages/__VUE/navbar/index.vue b/src/packages/__VUE/navbar/index.vue index d511a4c215..dda0d3f03c 100644 --- a/src/packages/__VUE/navbar/index.vue +++ b/src/packages/__VUE/navbar/index.vue @@ -58,7 +58,7 @@ export default create({ default: 10 } }, - emits: ['on-click-back', 'on-click-title', 'on-click-icon', 'on-click-right'], + emits: ['onClickBack', 'onClickTitle', 'onClickIcon', 'onClickRight'], setup(props, { emit }) { const { border, fixed, safeAreaInsetTop, placeholder } = toRefs(props); const navHeight = ref('auto'); @@ -98,19 +98,19 @@ export default create({ }); const handleLeft = () => { - emit('on-click-back'); + emit('onClickBack'); }; const handleCenter = () => { - emit('on-click-title'); + emit('onClickTitle'); }; const handleCenterIcon = () => { - emit('on-click-icon'); + emit('onClickIcon'); }; const handleRight = () => { - emit('on-click-right'); + emit('onClickRight'); }; return { diff --git a/src/packages/__VUE/noticebar/__tests__/noticebar.spec.ts b/src/packages/__VUE/noticebar/__tests__/noticebar.spec.ts index 16d000d304..c91f044012 100644 --- a/src/packages/__VUE/noticebar/__tests__/noticebar.spec.ts +++ b/src/packages/__VUE/noticebar/__tests__/noticebar.spec.ts @@ -36,7 +36,7 @@ test('across-end event', async () => { } }); wrapper.vm.onAnimationEnd(); - expect(wrapper.emitted('across-end')).toBeTruthy(); + expect(wrapper.emitted('acrossEnd')).toBeTruthy(); }); test('slot event', async () => { diff --git a/src/packages/__VUE/noticebar/index.taro.vue b/src/packages/__VUE/noticebar/index.taro.vue index 9b36f702a3..cff7da52bb 100644 --- a/src/packages/__VUE/noticebar/index.taro.vue +++ b/src/packages/__VUE/noticebar/index.taro.vue @@ -172,7 +172,7 @@ export default create({ Notice, CircleClose }, - emits: ['click', 'close', 'across-end'], + emits: ['click', 'close', 'acrossEnd'], setup(props, { emit, slots }) { const wrap = ref(null); @@ -326,7 +326,7 @@ export default create({ const onAnimationEnd = (event: Event) => { state.firstRound = false; - emit('across-end', event); + emit('acrossEnd', event); setTimeout(() => { state.duration = (state.offsetWidth + state.wrapWidth) / props.speed; state.animationClass = 'play-infinite'; diff --git a/src/packages/__VUE/noticebar/index.vue b/src/packages/__VUE/noticebar/index.vue index 8a5d290df1..9d14e6f637 100644 --- a/src/packages/__VUE/noticebar/index.vue +++ b/src/packages/__VUE/noticebar/index.vue @@ -179,7 +179,7 @@ export default create({ Notice, CircleClose }, - emits: ['click', 'close', 'across-end'], + emits: ['click', 'close', 'acrossEnd'], setup(props, { emit, slots }) { const wrap = ref(null); @@ -315,7 +315,7 @@ export default create({ const onAnimationEnd = (event: Event) => { state.firstRound = false; - emit('across-end', event); + emit('acrossEnd', event); setTimeout(() => { state.duration = (state.offsetWidth + state.wrapWidth) / props.speed; state.animationClass = 'play-infinite'; diff --git a/src/packages/__VUE/popup/__tests__/popup.spec.ts b/src/packages/__VUE/popup/__tests__/popup.spec.ts index 0988b68a88..9b402f91df 100644 --- a/src/packages/__VUE/popup/__tests__/popup.spec.ts +++ b/src/packages/__VUE/popup/__tests__/popup.spec.ts @@ -150,7 +150,7 @@ test('event click pop test', async () => { await nextTick(); const popup: any = wrapper.find('.nut-popup'); await popup.trigger('click'); - expect(wrapper.emitted('click-pop')).toBeTruthy(); + expect(wrapper.emitted('clickPop')).toBeTruthy(); }); test('event click-close-icon test', async () => { @@ -161,7 +161,7 @@ test('event click-close-icon test', async () => { } }); await wrapper.find('.nut-popup__close-icon').trigger('click'); - expect(wrapper.emitted('click-close-icon')).toBeTruthy(); + expect(wrapper.emitted('clickCloseIcon')).toBeTruthy(); }); test('should emit open event when prop visible is set to true', async () => { @@ -183,7 +183,7 @@ test('event close test', async () => { }); await wrapper.find('.nut-overlay').trigger('click'); await nextTick(); - expect(wrapper.emitted('click-overlay')).toBeTruthy(); + expect(wrapper.emitted('clickOverlay')).toBeTruthy(); }); test('event click-overlay test', async () => { @@ -195,5 +195,5 @@ test('event click-overlay test', async () => { const overlay: any = wrapper.find('.nut-overlay'); await overlay.trigger('click'); - expect(wrapper.emitted('click-overlay')).toBeTruthy(); + expect(wrapper.emitted('clickOverlay')).toBeTruthy(); }); diff --git a/src/packages/__VUE/popup/index.taro.vue b/src/packages/__VUE/popup/index.taro.vue index 4074e9e69a..437d540c20 100644 --- a/src/packages/__VUE/popup/index.taro.vue +++ b/src/packages/__VUE/popup/index.taro.vue @@ -46,7 +46,7 @@ export default create({ Close }, props: popupProps, - emits: ['click-pop', 'click-close-icon', 'open', 'close', 'opened', 'closed', 'click-overlay', 'update:visible'], + emits: ['clickPop', 'clickCloseIcon', 'open', 'close', 'opened', 'closed', 'clickOverlay', 'update:visible'], setup(props, { emit }) { const state = reactive({ @@ -102,18 +102,18 @@ export default create({ }; const onClick = (e: Event) => { - emit('click-pop', e); + emit('clickPop', e); }; const onClickCloseIcon = (e: Event) => { e.stopPropagation(); - emit('click-close-icon', e); + emit('clickCloseIcon', e); emit('update:visible', false); // close(); }; const onClickOverlay = (e: Event) => { - emit('click-overlay', e); + emit('clickOverlay', e); if (props.closeOnClickOverlay) { emit('update:visible', false); // close(); diff --git a/src/packages/__VUE/popup/index.vue b/src/packages/__VUE/popup/index.vue index 1a0cde0699..25f4cf5753 100644 --- a/src/packages/__VUE/popup/index.vue +++ b/src/packages/__VUE/popup/index.vue @@ -46,7 +46,7 @@ export default create({ Close }, props: popupProps, - emits: ['click-pop', 'click-close-icon', 'open', 'close', 'opened', 'closed', 'click-overlay', 'update:visible'], + emits: ['clickPop', 'clickCloseIcon', 'open', 'close', 'opened', 'closed', 'clickOverlay', 'update:visible'], setup(props, { emit }) { const state = reactive({ @@ -102,18 +102,18 @@ export default create({ }; const onClick = (e: Event) => { - emit('click-pop', e); + emit('clickPop', e); }; const onClickCloseIcon = (e: Event) => { e.stopPropagation(); - emit('click-close-icon', e); + emit('clickCloseIcon', e); emit('update:visible', false); // close(); }; const onClickOverlay = (e: Event) => { - emit('click-overlay', e); + emit('clickOverlay', e); if (props.closeOnClickOverlay) { emit('update:visible', false); // close(); diff --git a/src/packages/__VUE/range/index.taro.vue b/src/packages/__VUE/range/index.taro.vue index 8392f51fab..071c63b720 100644 --- a/src/packages/__VUE/range/index.taro.vue +++ b/src/packages/__VUE/range/index.taro.vue @@ -130,7 +130,7 @@ export default create({ } }, - emits: ['change', 'drag-end', 'drag-start', 'update:modelValue'], + emits: ['change', 'dragEnd', 'dragStart', 'update:modelValue'], setup(props, { emit }) { const buttonIndex = ref(0); @@ -357,7 +357,7 @@ export default create({ event.stopPropagation(); event.preventDefault(); if (dragStatus.value === 'start') { - emit('drag-start'); + emit('dragStart'); } touch.move(event); dragStatus.value = 'draging'; @@ -389,7 +389,7 @@ export default create({ } if (dragStatus.value === 'draging') { updateValue(currentValue, true); - emit('drag-end'); + emit('dragEnd'); } dragStatus.value = ''; event.stopPropagation(); diff --git a/src/packages/__VUE/range/index.vue b/src/packages/__VUE/range/index.vue index 21d2a14612..5d560e1575 100644 --- a/src/packages/__VUE/range/index.vue +++ b/src/packages/__VUE/range/index.vue @@ -127,7 +127,7 @@ export default create({ } }, - emits: ['change', 'drag-end', 'drag-start', 'update:modelValue'], + emits: ['change', 'dragEnd', 'dragStart', 'update:modelValue'], setup(props, { emit }) { const buttonIndex = ref(0); @@ -340,7 +340,7 @@ export default create({ } if (dragStatus.value === 'start') { - emit('drag-start'); + emit('dragStart'); } touch.move(event); @@ -371,7 +371,7 @@ export default create({ } if (dragStatus.value === 'draging') { updateValue(currentValue, true); - emit('drag-end'); + emit('dragEnd'); } dragStatus.value = ''; }; diff --git a/src/packages/__VUE/row/index.taro.vue b/src/packages/__VUE/row/index.taro.vue index a341ff27dd..b98ac7c5e3 100644 --- a/src/packages/__VUE/row/index.taro.vue +++ b/src/packages/__VUE/row/index.taro.vue @@ -31,7 +31,6 @@ export default create({ default: 'nowrap' } }, - emits: [], setup(props) { const prefixCls = componentName; provide('gutter', props.gutter); diff --git a/src/packages/__VUE/row/index.vue b/src/packages/__VUE/row/index.vue index a341ff27dd..b98ac7c5e3 100644 --- a/src/packages/__VUE/row/index.vue +++ b/src/packages/__VUE/row/index.vue @@ -31,7 +31,6 @@ export default create({ default: 'nowrap' } }, - emits: [], setup(props) { const prefixCls = componentName; provide('gutter', props.gutter); diff --git a/src/packages/__VUE/searchbar/index.taro.vue b/src/packages/__VUE/searchbar/index.taro.vue index acfc22b424..ac225c3b98 100644 --- a/src/packages/__VUE/searchbar/index.taro.vue +++ b/src/packages/__VUE/searchbar/index.taro.vue @@ -130,9 +130,9 @@ export default create({ 'focus', 'clear', 'search', - 'click-input', - 'click-left-icon', - 'click-right-icon' + 'clickInput', + 'clickLeftIcon', + 'clickRightIcon' ], setup(props, { emit }) { @@ -196,15 +196,15 @@ export default create({ }; const clickInput = (event: Event) => { - emit('click-input', event); + emit('clickInput', event); }; const leftIconClick = (event: Event) => { - emit('click-left-icon', props.modelValue, event); + emit('clickLeftIcon', props.modelValue, event); }; const rightIconClick = (event: Event) => { - emit('click-right-icon', props.modelValue, event); + emit('clickRightIcon', props.modelValue, event); }; const styleSearchbar = computed(() => { diff --git a/src/packages/__VUE/searchbar/index.vue b/src/packages/__VUE/searchbar/index.vue index 49e133a801..358e6b5571 100644 --- a/src/packages/__VUE/searchbar/index.vue +++ b/src/packages/__VUE/searchbar/index.vue @@ -131,9 +131,9 @@ export default create({ 'focus', 'clear', 'search', - 'click-input', - 'click-left-icon', - 'click-right-icon' + 'clickInput', + 'clickLeftIcon', + 'clickRightIcon' ], setup(props, { emit }) { @@ -197,15 +197,15 @@ export default create({ }; const clickInput = (event: Event) => { - emit('click-input', event); + emit('clickInput', event); }; const leftIconClick = (event: Event) => { - emit('click-left-icon', props.modelValue, event); + emit('clickLeftIcon', props.modelValue, event); }; const rightIconClick = (event: Event) => { - emit('click-right-icon', props.modelValue, event); + emit('clickRightIcon', props.modelValue, event); }; const styleSearchbar = computed(() => { diff --git a/src/packages/__VUE/sidenavbar/index.taro.vue b/src/packages/__VUE/sidenavbar/index.taro.vue index 475d3feb8e..8bec0536f7 100644 --- a/src/packages/__VUE/sidenavbar/index.taro.vue +++ b/src/packages/__VUE/sidenavbar/index.taro.vue @@ -18,7 +18,6 @@ export default create({ default: 15 } }, - emits: [], setup: (props) => { const list = ref(null) as Ref; const state = reactive({ diff --git a/src/packages/__VUE/sidenavbar/index.vue b/src/packages/__VUE/sidenavbar/index.vue index 840135bee9..c023c81f70 100644 --- a/src/packages/__VUE/sidenavbar/index.vue +++ b/src/packages/__VUE/sidenavbar/index.vue @@ -18,7 +18,6 @@ export default create({ default: 15 } }, - emits: [], setup: (props) => { const list = ref(null) as Ref; const state = reactive({ diff --git a/src/packages/__VUE/sku/__tests__/sku.spec.ts b/src/packages/__VUE/sku/__tests__/sku.spec.ts index 8bfbc8bde5..e91ea98263 100644 --- a/src/packages/__VUE/sku/__tests__/sku.spec.ts +++ b/src/packages/__VUE/sku/__tests__/sku.spec.ts @@ -26,7 +26,7 @@ test('sku select event', async () => { await nextTick(); const skuItem = wrapper.findAll('.nut-sku-select-item-skus-sku'); skuItem[1].trigger('click'); - expect(wrapper.emitted()['select-sku'][0]).toMatchSnapshot(); + expect(wrapper.emitted()['selectSku'][0]).toMatchSnapshot(); }); test('do not sell', async () => { @@ -55,5 +55,5 @@ test('button event', async () => { const confirm = wrapper.find('.nut-sku-operate-btn-confirm'); expect(confirm.exists()).toBeTruthy(); confirm.trigger('click'); - expect(wrapper.emitted()['click-btn-operate'][0]).toEqual([{ type: 'confirm', value: 1 }]); + expect(wrapper.emitted()['clickBtnOperate'][0]).toEqual([{ type: 'confirm', value: 1 }]); }); diff --git a/src/packages/__VUE/sku/components/SkuHeader.taro.vue b/src/packages/__VUE/sku/components/SkuHeader.taro.vue index 0b40f77952..75ab4bac1b 100644 --- a/src/packages/__VUE/sku/components/SkuHeader.taro.vue +++ b/src/packages/__VUE/sku/components/SkuHeader.taro.vue @@ -31,7 +31,6 @@ export default create({ default: {} } }, - emits: [], components: { [Price.name]: Price }, diff --git a/src/packages/__VUE/sku/index.taro.vue b/src/packages/__VUE/sku/index.taro.vue index fd478b92b6..9ed9fe0daa 100644 --- a/src/packages/__VUE/sku/index.taro.vue +++ b/src/packages/__VUE/sku/index.taro.vue @@ -141,15 +141,15 @@ export default create({ }, emits: [ 'update:visible', - 'select-sku', - 'change-stepper', - 'click-btn-operate', - 'click-close-icon', - 'click-overlay', + 'selectSku', + 'changeStepper', + 'clickBtnOperate', + 'clickCloseIcon', + 'clickOverlay', 'close', 'reduce', 'add', - 'over-limit' + 'overLimit' ], components: { @@ -185,14 +185,14 @@ export default create({ // 商品规格 sku 选择 const selectSku = (skus: any) => { - emit('select-sku', skus); + emit('selectSku', skus); }; // 数量计步器变化 const changeStepper = (value: number) => { goodsCount.value = value; - emit('change-stepper', value); + emit('changeStepper', value); }; // 修改购买数量 add 加 reduce 减 @@ -206,12 +206,12 @@ export default create({ // 触发极限值 const stepperOverLimit = (count: any) => { - emit('over-limit', count); + emit('overLimit', count); }; // 点击 button 操作 const clickBtnOperate = (btn: string) => { - emit('click-btn-operate', { + emit('clickBtnOperate', { type: btn, value: goodsCount.value }); @@ -220,11 +220,11 @@ export default create({ // 关闭 const closePopup = (type: string) => { if (type == 'icon') { - emit('click-close-icon'); + emit('clickCloseIcon'); } if (type == 'overlay') { - emit('click-overlay'); + emit('clickOverlay'); } if (type == 'close') { diff --git a/src/packages/__VUE/sku/index.vue b/src/packages/__VUE/sku/index.vue index 4014a270ee..42f300bbb9 100644 --- a/src/packages/__VUE/sku/index.vue +++ b/src/packages/__VUE/sku/index.vue @@ -141,15 +141,15 @@ export default create({ }, emits: [ 'update:visible', - 'select-sku', - 'change-stepper', - 'click-btn-operate', - 'click-close-icon', - 'click-overlay', + 'selectSku', + 'changeStepper', + 'clickBtnOperate', + 'clickCloseIcon', + 'clickOverlay', 'close', 'reduce', 'add', - 'over-limit' + 'overLimit' ], components: { @@ -189,14 +189,14 @@ export default create({ // 商品规格 sku 选择 const selectSku = (skus: any) => { - emit('select-sku', skus); + emit('selectSku', skus); }; // 数量计步器变化 const changeStepper = (value: number) => { goodsCount.value = value; - emit('change-stepper', value); + emit('changeStepper', value); }; // 修改购买数量 add 加 reduce 减 @@ -210,12 +210,12 @@ export default create({ // 触发极限值 const stepperOverLimit = (count: any) => { - emit('over-limit', count); + emit('overLimit', count); }; // 点击 button 操作 const clickBtnOperate = (btn: string) => { - emit('click-btn-operate', { + emit('clickBtnOperate', { type: btn, value: goodsCount.value }); @@ -224,11 +224,11 @@ export default create({ // 关闭 const closePopup = (type: string) => { if (type == 'icon') { - emit('click-close-icon'); + emit('clickCloseIcon'); } if (type == 'overlay') { - emit('click-overlay'); + emit('clickOverlay'); } if (type == 'close') { diff --git a/src/packages/__VUE/step/index.taro.vue b/src/packages/__VUE/step/index.taro.vue index 11ae8b1371..9361cbd59e 100644 --- a/src/packages/__VUE/step/index.taro.vue +++ b/src/packages/__VUE/step/index.taro.vue @@ -42,7 +42,7 @@ export default create({ default: '' } }, - emits: ['click-step'], + emits: ['clickStep'], setup() { const { proxy } = getCurrentInstance() as ComponentInternalInstance; diff --git a/src/packages/__VUE/step/index.vue b/src/packages/__VUE/step/index.vue index 11ae8b1371..9361cbd59e 100644 --- a/src/packages/__VUE/step/index.vue +++ b/src/packages/__VUE/step/index.vue @@ -42,7 +42,7 @@ export default create({ default: '' } }, - emits: ['click-step'], + emits: ['clickStep'], setup() { const { proxy } = getCurrentInstance() as ComponentInternalInstance; diff --git a/src/packages/__VUE/steps/index.taro.vue b/src/packages/__VUE/steps/index.taro.vue index 3217e5eec7..13b55c4d1a 100644 --- a/src/packages/__VUE/steps/index.taro.vue +++ b/src/packages/__VUE/steps/index.taro.vue @@ -18,7 +18,7 @@ export default create({ default: false } }, - emits: ['click-step'], + emits: ['clickStep'], setup(props, { emit, slots }) { const state = reactive({ children: [] as ComponentInternalInstance[] @@ -38,7 +38,7 @@ export default create({ }; const onEmit = (index: number) => { - emit('click-step', index); + emit('clickStep', index); }; provide('parent', { diff --git a/src/packages/__VUE/steps/index.vue b/src/packages/__VUE/steps/index.vue index 3217e5eec7..13b55c4d1a 100644 --- a/src/packages/__VUE/steps/index.vue +++ b/src/packages/__VUE/steps/index.vue @@ -18,7 +18,7 @@ export default create({ default: false } }, - emits: ['click-step'], + emits: ['clickStep'], setup(props, { emit, slots }) { const state = reactive({ children: [] as ComponentInternalInstance[] @@ -38,7 +38,7 @@ export default create({ }; const onEmit = (index: number) => { - emit('click-step', index); + emit('clickStep', index); }; provide('parent', { diff --git a/src/packages/__VUE/subsidenavbar/index.taro.vue b/src/packages/__VUE/subsidenavbar/index.taro.vue index 90c75c5e58..3a0ce2333b 100644 --- a/src/packages/__VUE/subsidenavbar/index.taro.vue +++ b/src/packages/__VUE/subsidenavbar/index.taro.vue @@ -38,7 +38,7 @@ export default create({ } }, components: { ArrowDown2, ArrowUp2 }, - emits: ['title-click'], + emits: ['titleClick'], setup: (props: any, context: any) => { const state = reactive({ direction: '' @@ -55,7 +55,7 @@ export default create({ }; }); const handleClick = () => { - context.emit('title-click'); + context.emit('titleClick'); state.direction = !state.direction ? 'up' : ''; }; onMounted(() => { diff --git a/src/packages/__VUE/subsidenavbar/index.vue b/src/packages/__VUE/subsidenavbar/index.vue index 6623f6825e..81e6be13f8 100644 --- a/src/packages/__VUE/subsidenavbar/index.vue +++ b/src/packages/__VUE/subsidenavbar/index.vue @@ -38,7 +38,7 @@ export default create({ } }, components: { ArrowDown2, ArrowUp2 }, - emits: ['title-click'], + emits: ['titleClick'], setup: (props: any, context: any) => { const state = reactive({ direction: '' @@ -55,7 +55,7 @@ export default create({ }; }); const handleClick = () => { - context.emit('title-click'); + context.emit('titleClick'); state.direction = !state.direction ? 'up' : ''; }; onMounted(() => { diff --git a/src/packages/__VUE/tabbar/index.taro.vue b/src/packages/__VUE/tabbar/index.taro.vue index 81b9f5c4de..17d9b0fe91 100644 --- a/src/packages/__VUE/tabbar/index.taro.vue +++ b/src/packages/__VUE/tabbar/index.taro.vue @@ -50,7 +50,7 @@ export default create({ default: false } }, - emits: ['tab-switch', 'update:modelValue'], + emits: ['tabSwitch', 'update:modelValue'], setup(props, { emit }) { const { bottom, placeholder } = toRefs(props); const mdValue = reactive({ @@ -61,7 +61,7 @@ export default create({ function changeIndex(index: number, active: number | string) { emit('update:modelValue', active); parentData.modelValue = active; - emit('tab-switch', parentData.children[index], active); + emit('tabSwitch', parentData.children[index], active); } let parentData = reactive({ children: mdValue.children, diff --git a/src/packages/__VUE/tabbar/index.vue b/src/packages/__VUE/tabbar/index.vue index 1fdca866ea..3a55445f86 100644 --- a/src/packages/__VUE/tabbar/index.vue +++ b/src/packages/__VUE/tabbar/index.vue @@ -45,7 +45,7 @@ export default create({ default: false } }, - emits: ['tab-switch', 'update:modelValue'], + emits: ['tabSwitch', 'update:modelValue'], setup(props, { emit }) { const { bottom, placeholder } = toRefs(props); const height = ref(); @@ -57,7 +57,7 @@ export default create({ function changeIndex(index: number, active: number | string) { emit('update:modelValue', active); parentData.modelValue = active; - emit('tab-switch', parentData.children[index], active); + emit('tabSwitch', parentData.children[index], active); } let parentData = reactive({ children: mdValue.children, diff --git a/src/packages/__VUE/uploader/__tests__/index.spec.ts b/src/packages/__VUE/uploader/__tests__/index.spec.ts index eac9561571..11f24a4182 100644 --- a/src/packages/__VUE/uploader/__tests__/index.spec.ts +++ b/src/packages/__VUE/uploader/__tests__/index.spec.ts @@ -82,7 +82,7 @@ test('should render base uploader other props', async () => { const toast2 = wrapper.find('.nut-uploader__preview-img__c'); expect(toast2.exists()).toBe(true); toast2.trigger('click'); - expect(wrapper.emitted('file-item-click')).toBeTruthy(); + expect(wrapper.emitted('fileItemClick')).toBeTruthy(); expect(toast2.attributes().src).toBe( 'https://m.360buyimg.com/babel/jfs/t1/164410/22/25162/93384/616eac6cE6c711350/0cac53c1b82e1b05.gif' ); diff --git a/src/packages/__VUE/uploader/index.taro.vue b/src/packages/__VUE/uploader/index.taro.vue index 9e9f727202..e0794efdfc 100644 --- a/src/packages/__VUE/uploader/index.taro.vue +++ b/src/packages/__VUE/uploader/index.taro.vue @@ -156,7 +156,7 @@ export default create({ 'change', 'delete', 'update:fileList', - 'file-item-click' + 'fileItemClick' ], setup(props, { emit }) { const fileList = ref(props.fileList as Array); @@ -244,7 +244,7 @@ export default create({ }; const fileItemClick = (fileItem: FileItem) => { - emit('file-item-click', { fileItem }); + emit('fileItemClick', { fileItem }); }; const executeUpload = (fileItem: FileItem, index: number) => { diff --git a/src/packages/__VUE/uploader/index.vue b/src/packages/__VUE/uploader/index.vue index 6d991bb683..e4fff1887a 100644 --- a/src/packages/__VUE/uploader/index.vue +++ b/src/packages/__VUE/uploader/index.vue @@ -136,7 +136,7 @@ export default create({ 'change', 'delete', 'update:fileList', - 'file-item-click' + 'fileItemClick' ], setup(props, { emit }) { const fileList = ref(props.fileList as Array); @@ -169,7 +169,7 @@ export default create({ }; const fileItemClick = (fileItem: FileItem) => { - emit('file-item-click', { fileItem }); + emit('fileItemClick', { fileItem }); }; const executeUpload = (fileItem: FileItem, index: number) => {