From 5b583962dbe704887193d0ac28cbf0d45880299e Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Sun, 22 May 2022 16:39:57 +0800 Subject: [PATCH] style: lint format --- components/_util/props-util/index.js | 3 +- components/radio/RadioButton.tsx | 2 +- components/upload/UploadList/ListItem.tsx | 3 +- components/upload/interface.tsx | 4 +-- components/vc-dropdown/Dropdown.tsx | 3 +- components/vc-input/BaseInput.tsx | 5 ++-- components/vc-tree-select/TreeSelect.tsx | 2 +- .../vc-tree-select/TreeSelectContext.ts | 2 +- components/vc-tree/Tree.tsx | 28 +++++++++++++++++-- components/vc-tree/index.ts | 2 +- components/vc-tree/props.ts | 9 ++++-- 11 files changed, 46 insertions(+), 17 deletions(-) diff --git a/components/_util/props-util/index.js b/components/_util/props-util/index.js index 03215f80a..101634eea 100644 --- a/components/_util/props-util/index.js +++ b/components/_util/props-util/index.js @@ -71,6 +71,7 @@ const getSlots = ele => { return { ...slots, ...getScopedSlots(ele) }; }; +export const skipFlattenKey = Symbol('skipFlatten'); const flattenChildren = (children = [], filterEmpty = true) => { const temp = Array.isArray(children) ? children : [children]; const res = []; @@ -78,7 +79,7 @@ const flattenChildren = (children = [], filterEmpty = true) => { if (Array.isArray(child)) { res.push(...flattenChildren(child, filterEmpty)); } else if (child && child.type === Fragment) { - if (child.props && child.props.skipFlatten) { + if (child.key === skipFlattenKey) { res.push(child); } else { res.push(...flattenChildren(child.children, filterEmpty)); diff --git a/components/radio/RadioButton.tsx b/components/radio/RadioButton.tsx index 8ddc7275b..6ffbb0fb6 100644 --- a/components/radio/RadioButton.tsx +++ b/components/radio/RadioButton.tsx @@ -11,7 +11,7 @@ export default defineComponent({ useProvideRadioOptionTypeContext('button'); return () => { return ( - + {slots.default?.()} ); diff --git a/components/upload/UploadList/ListItem.tsx b/components/upload/UploadList/ListItem.tsx index f3fe63291..c8642408d 100644 --- a/components/upload/UploadList/ListItem.tsx +++ b/components/upload/UploadList/ListItem.tsx @@ -50,7 +50,6 @@ export const listItemProps = () => { }; export type ListItemProps = Partial>>; - export default defineComponent({ name: 'ListItem', inheritAttrs: false, @@ -110,7 +109,7 @@ export default defineComponent({ src={file.thumbUrl || file.url} alt={file.name} class={`${prefixCls}-list-item-image`} - crossOrigin={file.crossOrigin} + crossorigin={file.crossOrigin} /> ) : ( iconNode diff --git a/components/upload/interface.tsx b/components/upload/interface.tsx index cabe9fbec..b9b680705 100755 --- a/components/upload/interface.tsx +++ b/components/upload/interface.tsx @@ -4,7 +4,7 @@ import type { } from '../vc-upload/interface'; import type { ProgressProps } from '../progress'; import type { VueNode } from '../_util/type'; -import type { ExtractPropTypes, PropType, CSSProperties } from 'vue'; +import type { ExtractPropTypes, PropType, CSSProperties, ImgHTMLAttributes } from 'vue'; export interface FileType extends OriRcFile { readonly lastModifiedDate: Date; @@ -27,7 +27,7 @@ export interface UploadFile { status?: UploadFileStatus; percent?: number; thumbUrl?: string; - crossOrigin?: HTMLImageElement['crossOrigin']; + crossOrigin?: ImgHTMLAttributes['crossorigin']; originFileObj?: FileType; response?: T; error?: any; diff --git a/components/vc-dropdown/Dropdown.tsx b/components/vc-dropdown/Dropdown.tsx index 69c85789e..f267bd217 100644 --- a/components/vc-dropdown/Dropdown.tsx +++ b/components/vc-dropdown/Dropdown.tsx @@ -5,6 +5,7 @@ import Trigger from '../vc-trigger'; import placements from './placements'; import { cloneElement } from '../_util/vnode'; import classNames from '../_util/classNames'; +import { skipFlattenKey } from '../_util/props-util'; export default defineComponent({ props: { @@ -72,7 +73,7 @@ export default defineComponent({ getPopupContainer: () => triggerRef.value.getPopupDomNode(), }; return ( - + {props.arrow &&
} {cloneElement(overlayElement, extraOverlayProps, false)} diff --git a/components/vc-input/BaseInput.tsx b/components/vc-input/BaseInput.tsx index 6e8ef61e3..729ca6a47 100644 --- a/components/vc-input/BaseInput.tsx +++ b/components/vc-input/BaseInput.tsx @@ -1,3 +1,4 @@ +import type { CSSProperties } from 'vue'; import { defineComponent, ref } from 'vue'; import classNames from '../_util/classNames'; import type { MouseEventHandler } from '../_util/EventInterface'; @@ -101,7 +102,7 @@ export default defineComponent({ element = (