mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-04 20:27:44 +08:00
refactor(components): [tree & date-picker] use public function and type (#16017)
This commit is contained in:
parent
76b0d5fcb5
commit
6ccc8ee915
@ -593,7 +593,7 @@ const isValidValue = (date: unknown) => {
|
||||
}
|
||||
|
||||
const formatToString = (value: Dayjs | Dayjs[]) => {
|
||||
return Array.isArray(value)
|
||||
return isArray(value)
|
||||
? (value as Dayjs[]).map((_) => _.format(props.format))
|
||||
: (value as Dayjs).format(props.format)
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import type { Ref } from 'vue'
|
||||
import type ElSelect from '@element-plus/components/select'
|
||||
import type Node from '@element-plus/components/tree/src/model/node'
|
||||
import type { TreeNodeData } from '@element-plus/components/tree/src/tree.type'
|
||||
import type { TreeInstance } from '@element-plus/components/tree'
|
||||
|
||||
export const useTree = (
|
||||
props,
|
||||
@ -27,7 +28,7 @@ export const useTree = (
|
||||
key,
|
||||
}: {
|
||||
select: Ref<InstanceType<typeof ElSelect> | undefined>
|
||||
tree: Ref<InstanceType<typeof ElTree> | undefined>
|
||||
tree: Ref<TreeInstance | undefined>
|
||||
key: Ref<string>
|
||||
}
|
||||
) => {
|
||||
@ -208,9 +209,7 @@ export const useTree = (
|
||||
if (props.multiple) {
|
||||
emit(
|
||||
UPDATE_MODEL_EVENT,
|
||||
cachedKeys.concat(
|
||||
(tree.value as InstanceType<typeof ElTree>).getCheckedKeys(true)
|
||||
)
|
||||
cachedKeys.concat((tree.value as TreeInstance).getCheckedKeys(true))
|
||||
)
|
||||
} else {
|
||||
// select first leaf node when check parent
|
||||
|
Loading…
Reference in New Issue
Block a user