From e2e0a2bcb1037e6eee874e71143b3dca8e9ce7d6 Mon Sep 17 00:00:00 2001 From: nemo-shen Date: Fri, 10 Sep 2021 11:06:32 +0800 Subject: [PATCH] refactor(VantComponent): remove null type (#4476) --- packages/area/index.ts | 3 ++- packages/checkbox/index.ts | 3 ++- packages/circle/index.ts | 3 ++- packages/grid/index.ts | 3 ++- packages/overlay/index.ts | 3 ++- packages/radio/index.ts | 3 ++- packages/share-sheet/index.ts | 3 ++- packages/skeleton/index.ts | 5 +++-- packages/swipe-cell/index.ts | 3 ++- packages/tabs/index.ts | 8 +++++--- packages/tree-select/index.ts | 3 ++- packages/uploader/index.ts | 6 ++++-- 12 files changed, 30 insertions(+), 16 deletions(-) diff --git a/packages/area/index.ts b/packages/area/index.ts index ea338929..c657961e 100644 --- a/packages/area/index.ts +++ b/packages/area/index.ts @@ -27,7 +27,8 @@ VantComponent({ observer: 'setValues', }, columnsNum: { - type: null, + type: Number, + optionalTypes: [String], value: 3, }, columnsPlaceholder: { diff --git a/packages/checkbox/index.ts b/packages/checkbox/index.ts index e380c74e..10ed8e7f 100644 --- a/packages/checkbox/index.ts +++ b/packages/checkbox/index.ts @@ -31,7 +31,8 @@ VantComponent({ value: 'round', }, iconSize: { - type: null, + type: Number, + optionalTypes: [String], value: 20, }, }, diff --git a/packages/circle/index.ts b/packages/circle/index.ts index 28d73067..53d27ab4 100644 --- a/packages/circle/index.ts +++ b/packages/circle/index.ts @@ -41,7 +41,8 @@ VantComponent({ value: WHITE, }, color: { - type: null, + type: String, + optionalTypes: [Object], value: BLUE, observer() { this.setHoverColor().then(() => { diff --git a/packages/grid/index.ts b/packages/grid/index.ts index 0fa96bcc..39af3181 100644 --- a/packages/grid/index.ts +++ b/packages/grid/index.ts @@ -10,7 +10,8 @@ VantComponent({ observer: 'updateChildren', }, gutter: { - type: null, + type: Number, + optionalTypes: [String], value: 0, observer: 'updateChildren', }, diff --git a/packages/overlay/index.ts b/packages/overlay/index.ts index 0fdfa777..eab4b8bd 100644 --- a/packages/overlay/index.ts +++ b/packages/overlay/index.ts @@ -5,7 +5,8 @@ VantComponent({ show: Boolean, customStyle: String, duration: { - type: null, + type: Number, + optionalTypes: [String], value: 300, }, zIndex: { diff --git a/packages/radio/index.ts b/packages/radio/index.ts index 4f0ffc3e..4e8220f2 100644 --- a/packages/radio/index.ts +++ b/packages/radio/index.ts @@ -27,7 +27,8 @@ VantComponent({ value: 'round', }, iconSize: { - type: null, + type: Number, + optionalTypes: [String], value: 20, }, }, diff --git a/packages/share-sheet/index.ts b/packages/share-sheet/index.ts index 029d7246..a9ffe2da 100644 --- a/packages/share-sheet/index.ts +++ b/packages/share-sheet/index.ts @@ -34,7 +34,8 @@ VantComponent({ value: true, }, duration: { - type: null, + type: Number, + optionalTypes: [String], value: 300, }, }, diff --git a/packages/skeleton/index.ts b/packages/skeleton/index.ts index a41e33e8..b9b2e8f4 100644 --- a/packages/skeleton/index.ts +++ b/packages/skeleton/index.ts @@ -33,9 +33,10 @@ VantComponent({ value: '40%', }, rowWidth: { - type: null, + type: String, + optionalTypes: [Array], value: '100%', - observer(val) { + observer(val: string | string[]) { this.setData({ isArray: val instanceof Array }); }, }, diff --git a/packages/swipe-cell/index.ts b/packages/swipe-cell/index.ts index ae593c6c..258e1527 100644 --- a/packages/swipe-cell/index.ts +++ b/packages/swipe-cell/index.ts @@ -28,7 +28,8 @@ VantComponent({ }, asyncClose: Boolean, name: { - type: null, + type: String, + optionalTypes: [Number], value: '', }, }, diff --git a/packages/tabs/index.ts b/packages/tabs/index.ts index 12cca30f..4ef9a1d0 100644 --- a/packages/tabs/index.ts +++ b/packages/tabs/index.ts @@ -37,12 +37,14 @@ VantComponent({ }, }, lineWidth: { - type: null, + type: Number, + optionalTypes: [String], value: 40, observer: 'resize', }, lineHeight: { - type: null, + type: Number, + optionalTypes: [String], value: -1, }, active: { @@ -98,7 +100,7 @@ VantComponent({ scrollLeft: 0, scrollable: false, currentIndex: 0, - container: null as unknown as () => WechatMiniprogram.NodesRef, + container: (null as unknown) as () => WechatMiniprogram.NodesRef, skipTransition: true, scrollWithAnimation: false, lineOffsetLeft: 0, diff --git a/packages/tree-select/index.ts b/packages/tree-select/index.ts index ff46fdaa..aca18cd1 100644 --- a/packages/tree-select/index.ts +++ b/packages/tree-select/index.ts @@ -22,7 +22,8 @@ VantComponent({ observer: 'updateSubItems', }, height: { - type: null, + type: Number, + optionalTypes: [String], value: 300, }, max: { diff --git a/packages/uploader/index.ts b/packages/uploader/index.ts index 0ab1c44f..0f44bf25 100644 --- a/packages/uploader/index.ts +++ b/packages/uploader/index.ts @@ -12,11 +12,13 @@ VantComponent({ afterRead: null, beforeRead: null, previewSize: { - type: null, + type: Number, + optionalTypes: [String], value: 80, }, name: { - type: null, + type: String, + optionalTypes: [Number], value: '', }, accept: {