From a30ff6e7c243d2a782d9ac6db0a2829d2bdd3c79 Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Wed, 8 May 2024 19:40:45 +0800 Subject: [PATCH] refactor: optimize code --- components/uni-collapse-item/uni-collapse-item.vue | 2 +- components/uni-collapse/uni-collapse.vue | 2 +- pages/directive/v-bind/Foo-composition.uvue | 1 + pages/directive/v-text/v-text.test.js | 2 +- pages/reactivity/core/watch/watch-composition.uvue | 1 - pages/reactivity/core/watch/watch-options.uvue | 2 -- 6 files changed, 4 insertions(+), 6 deletions(-) diff --git a/components/uni-collapse-item/uni-collapse-item.vue b/components/uni-collapse-item/uni-collapse-item.vue index afacaae..8ac013d 100644 --- a/components/uni-collapse-item/uni-collapse-item.vue +++ b/components/uni-collapse-item/uni-collapse-item.vue @@ -60,7 +60,7 @@ openCollapse(open: boolean) { if (this.disabled) return // å…³é—其他已打开 - $dispatch(this, 'UniCollapse', 'cloceAll') + $dispatch(this, 'UniCollapse', 'closeAll') this.is_open = open this.openOrClose(open) }, diff --git a/components/uni-collapse/uni-collapse.vue b/components/uni-collapse/uni-collapse.vue index 8c093e6..0b7e7c3 100644 --- a/components/uni-collapse/uni-collapse.vue +++ b/components/uni-collapse/uni-collapse.vue @@ -26,7 +26,7 @@ this.child_nodes.push(child) }, // å…³é—所有 - cloceAll() { + closeAll() { // å¼€å¯æ‰‹é£Žç´æ•ˆæžœæ‰å›žå…³é—其他 if (this.accordion && this.child_nodes.length > 0) { this.child_nodes.forEach((item) => { diff --git a/pages/directive/v-bind/Foo-composition.uvue b/pages/directive/v-bind/Foo-composition.uvue index 6900569..85412a0 100644 --- a/pages/directive/v-bind/Foo-composition.uvue +++ b/pages/directive/v-bind/Foo-composition.uvue @@ -27,6 +27,7 @@ defineProps({ }, obj: { // #ifdef APP-ANDROID + // TODO: 确认类型是å¦åˆç† type: FooPropsObj1ReactiveObject, // #endif // #ifdef APP-IOS || WEB diff --git a/pages/directive/v-text/v-text.test.js b/pages/directive/v-text/v-text.test.js index 548a35c..06d9d4e 100644 --- a/pages/directive/v-text/v-text.test.js +++ b/pages/directive/v-text/v-text.test.js @@ -4,7 +4,7 @@ const COMPOSITION_PAGE_PATH = '/pages/directive/v-text/v-text-composition' describe('v-text', () => { if (!process.env.uniTestPlatformInfo.startsWith('web')) { // TODO: ä»… web æ”¯æŒ - it('web', async () => { + it('not web', async () => { expect(1).toBe(1) }) return diff --git a/pages/reactivity/core/watch/watch-composition.uvue b/pages/reactivity/core/watch/watch-composition.uvue index ba451d2..5e3a9e6 100644 --- a/pages/reactivity/core/watch/watch-composition.uvue +++ b/pages/reactivity/core/watch/watch-composition.uvue @@ -105,7 +105,6 @@ const stopWatchCount = watch(count, (count : number, prevCount : number, onClean // 侦å¬å™¨åœ¨å“应å¼ä¾èµ–改å˜æ—¶ç«‹å³è§¦å‘ flush: 'sync', // å“应属性或引用作为ä¾èµ–项被跟踪时调用 - // TODO: vue 3.4 开始, æ•°æ®æ›´æ–°,ä¹Ÿä¼šè§¦å‘ onTrack, å¾…å‡çº§ vue 版本时,需è¦ç¡®è®¤è¯¥å˜åŒ–是å¦åˆç†åŠè·Ÿè¿› onTrack(event : DebuggerEvent) { if (event.type === 'get') { watchCountTrackNum.value++ diff --git a/pages/reactivity/core/watch/watch-options.uvue b/pages/reactivity/core/watch/watch-options.uvue index ea46b69..2f2064f 100644 --- a/pages/reactivity/core/watch/watch-options.uvue +++ b/pages/reactivity/core/watch/watch-options.uvue @@ -120,7 +120,6 @@ // 侦å¬å™¨åœ¨å“应å¼ä¾èµ–改å˜æ—¶ç«‹å³è§¦å‘ flush: 'sync', // å“应属性或引用作为ä¾èµ–项被跟踪时调用 - // TODO: vue 3.4 开始, æ•°æ®æ›´æ–°,ä¹Ÿä¼šè§¦å‘ onTrack, å¾…å‡çº§ vue 版本时,需è¦ç¡®è®¤è¯¥å˜åŒ–是å¦åˆç†åŠè·Ÿè¿› onTrack(event : DebuggerEvent) { if (event.type === 'get') { self.watchCountTrackNum++ @@ -144,7 +143,6 @@ // 侦å¬å™¨åœ¨å“应å¼ä¾èµ–改å˜æ—¶ç«‹å³è§¦å‘ flush: 'sync', // å“应属性或引用作为ä¾èµ–项被跟踪时调用 - // TODO: vue 3.4 开始, æ•°æ®æ›´æ–°,ä¹Ÿä¼šè§¦å‘ onTrack, å¾…å‡çº§ vue 版本时,需è¦ç¡®è®¤è¯¥å˜åŒ–是å¦åˆç†åŠè·Ÿè¿› onTrack(event : DebuggerEvent) { if (event.type === 'get') { self.watchCountTrackNum++ -- GitLab