mirror of
https://gitee.com/wot-design-uni/wot-design-uni.git
synced 2025-12-06 17:18:40 +08:00
feat: ✨ cell组件border属性以props为最高优先级 (#656)
* feat: ✨ cell组件border属性以props为最高优先级 * refactor: ♻️ 替换`??`运算符为更兼容的方式
This commit is contained in:
parent
b2b2db0a8a
commit
31353ceafa
@ -69,7 +69,8 @@
|
||||
|
||||
```html
|
||||
<wd-cell-group title="交易管理" border>
|
||||
<wd-cell title="标题文字" value="内容"></wd-cell>
|
||||
<wd-cell title="标题文字" value="内容" />
|
||||
<wd-cell :border="false" title="标题文字" label="这一个cell不想要边框" value="内容" />
|
||||
<wd-cell title="标题文字" label="描述信息" value="内容"></wd-cell>
|
||||
</wd-cell-group>
|
||||
```
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
<demo-block title="展示边框线" transparent>
|
||||
<wd-cell-group title="交易管理" border>
|
||||
<wd-cell title="标题文字" value="内容" />
|
||||
<wd-cell :border="false" title="标题文字" label="这一个cell不想要边框" value="内容" />
|
||||
<wd-cell title="标题文字" label="描述信息" value="内容"></wd-cell>
|
||||
</wd-cell-group>
|
||||
</demo-block>
|
||||
|
||||
@ -358,6 +358,10 @@ export function isNotUndefined<T>(value: T): value is NotUndefined<T> {
|
||||
return !isUndefined(value)
|
||||
}
|
||||
|
||||
export function isNone(value: any): value is null | undefined {
|
||||
return value === null || value === void 0
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查给定的值是否为奇数
|
||||
* @param value 要检查的值
|
||||
|
||||
@ -44,7 +44,7 @@ export const cellProps = {
|
||||
/**
|
||||
* 是否展示边框线
|
||||
*/
|
||||
border: Boolean,
|
||||
border: makeBooleanProp(void 0),
|
||||
/**
|
||||
* 设置左侧标题宽度
|
||||
*/
|
||||
|
||||
@ -63,7 +63,7 @@ import { useCell } from '../composables/useCell'
|
||||
import { useParent } from '../composables/useParent'
|
||||
import { FORM_KEY } from '../wd-form/types'
|
||||
import { cellProps } from './types'
|
||||
import { isDef } from '../common/util'
|
||||
import { isNone } from '../common/util'
|
||||
|
||||
const props = defineProps(cellProps)
|
||||
const emit = defineEmits(['click'])
|
||||
@ -71,7 +71,7 @@ const emit = defineEmits(['click'])
|
||||
const cell = useCell()
|
||||
|
||||
const isBorder = computed(() => {
|
||||
return isDef(cell.border.value) ? cell.border.value : props.border
|
||||
return Boolean(!isNone(props.border) ? props.border : cell.border.value)
|
||||
})
|
||||
|
||||
const { parent: form } = useParent(FORM_KEY)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user