Skip to content

Commit 604e9f3

Browse files
author
xuqingkai
committed
fix: 🐛 修复部分可为null的props丢失null类型的问题
1 parent f23dfa0 commit 604e9f3

File tree

7 files changed

+28
-17
lines changed

7 files changed

+28
-17
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@
130130
"ios >= 9"
131131
],
132132
"lint-staged": {
133-
"*.{js,ts,vue}": "eslint --fix --ext .js,.vue,.ts src",
134-
"*.{ts,vue}": "vue-tsc --noEmit"
133+
"*.{js,ts,vue}": "eslint --fix --ext .js,.vue,.ts src"
135134
},
136135
"uni-app": {
137136
"scripts": {

src/uni_modules/wot-design-uni/components/common/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,8 @@ export function objToStyle(styles: Record<string, any> | Record<string, any>[]):
416416
return ''
417417
}
418418

419-
export const requestAnimationFrame = (cb = () => void 0) => {
420-
return new Promise((resolve, reject) => {
419+
export const requestAnimationFrame = (cb = () => {}) => {
420+
return new Promise((resolve) => {
421421
const timer = setInterval(() => {
422422
clearInterval(timer)
423423
resolve(true)

src/uni_modules/wot-design-uni/components/wd-badge/types.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/*
22
* @Author: weisheng
33
* @Date: 2024-03-15 11:36:12
4-
* @LastEditTime: 2024-03-18 13:19:32
4+
* @LastEditTime: 2024-03-19 16:33:12
55
* @LastEditors: weisheng
66
* @Description:
77
* @FilePath: \wot-design-uni\src\uni_modules\wot-design-uni\components\wd-badge\types.ts
88
* 记得注释
99
*/
10-
import type { ExtractPropTypes } from 'vue'
11-
import { baseProps, makeBooleanProp, makeNumericProp, makeStringProp } from '../common/props'
10+
import type { ExtractPropTypes, PropType } from 'vue'
11+
import { baseProps, makeBooleanProp, makeStringProp } from '../common/props'
1212

1313
export type BadgeType = 'primary' | 'success' | 'warning' | 'danger' | 'info'
1414

@@ -17,7 +17,10 @@ export const badgeProps = {
1717
/**
1818
* 显示值
1919
*/
20-
modelValue: makeNumericProp(null),
20+
modelValue: {
21+
type: [Number, String, null] as PropType<number | string | null>,
22+
default: null
23+
},
2124
/** 当数值为 0 时,是否展示徽标 */
2225
showZero: makeBooleanProp(false),
2326
bgColor: String,

src/uni_modules/wot-design-uni/components/wd-calendar-view/yearPanel/year-panel.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ onMounted(() => {
6666
scrollIntoView()
6767
})
6868
69-
const requestAnimationFrame = (cb = () => void 0) => {
69+
const requestAnimationFrame = (cb = () => {}) => {
7070
return new Promise((resolve, reject) => {
7171
uni
7272
.createSelectorQuery()

src/uni_modules/wot-design-uni/components/wd-checkbox/types.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { ExtractPropTypes } from 'vue'
2-
import { baseProps, makeBooleanProp, makeStringProp } from '../common/props'
1+
import type { ExtractPropTypes, PropType } from 'vue'
2+
import { baseProps, makeStringProp } from '../common/props'
33

44
export type CheckShape = 'circle' | 'square' | 'button'
55

@@ -26,7 +26,10 @@ export const checkboxProps = {
2626
/**
2727
* 禁用
2828
*/
29-
disabled: makeBooleanProp(null),
29+
disabled: {
30+
type: [Boolean, null] as PropType<boolean | null>,
31+
default: null
32+
},
3033
/**
3134
* 选中值,在 checkbox-group 中使用无效,需同 false-value 一块使用
3235
*/

src/uni_modules/wot-design-uni/components/wd-sidebar-item/types.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { ExtractPropTypes, PropType } from 'vue'
2-
import { baseProps, makeBooleanProp, makeNumberProp, makeNumericProp, makeRequiredProp } from '../common/props'
1+
import type { ExtractPropTypes, Prop, PropType } from 'vue'
2+
import { baseProps, makeBooleanProp, makeNumberProp, makeRequiredProp } from '../common/props'
33
import type { BadgeProps } from '../wd-badge/types'
44

55
export const sidebarItemProps = {
@@ -9,7 +9,10 @@ export const sidebarItemProps = {
99
/** 当前选项的值,唯一标识 */
1010
value: makeRequiredProp([Number, String]),
1111
/** 徽标显示值 */
12-
badge: makeNumericProp(null),
12+
badge: {
13+
type: [String, Number, null] as PropType<string | number | null>,
14+
default: null
15+
},
1316
/** 徽标属性,透传给 Badge 组件 */
1417
badgeProps: Object as PropType<Partial<BadgeProps>>,
1518
/** 图标 */

src/uni_modules/wot-design-uni/components/wd-tabbar-item/types.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ExtractPropTypes, PropType } from 'vue'
2-
import { baseProps, makeNumberProp, makeNumericProp, numericProp } from '../common/props'
2+
import { baseProps, makeNumberProp, numericProp } from '../common/props'
33
import type { BadgeProps } from '../wd-badge/types'
44

55
/**
@@ -27,7 +27,10 @@ export const tabbarItemProps = {
2727
/**
2828
* 徽标显示值
2929
*/
30-
value: makeNumericProp(null),
30+
value: {
31+
type: [Number, String, null] as PropType<number | string | null>,
32+
default: null
33+
},
3134
/**
3235
* 是否点状徽标
3336
*/

0 commit comments

Comments
 (0)