fix: typography #6244
							parent
							
								
									82c4c8f0d3
								
							
						
					
					
						commit
						197e209b4e
					
				|  | @ -31,6 +31,7 @@ import type { EventHandler } from '../_util/EventInterface'; | |||
| import omit from '../_util/omit'; | ||||
| import type { AutoSizeType } from '../input/inputProps'; | ||||
| import useMergedState from '../_util/hooks/useMergedState'; | ||||
| import { findDOMNode } from '../_util/props-util'; | ||||
| 
 | ||||
| export type BaseType = 'secondary' | 'success' | 'warning' | 'danger'; | ||||
| 
 | ||||
|  | @ -198,7 +199,9 @@ const Base = defineComponent({ | |||
|     }); | ||||
| 
 | ||||
|     function getChildrenText(): string { | ||||
|       return props.ellipsis || props.editable ? props.content : contentRef.value?.$el?.innerText; | ||||
|       return props.ellipsis || props.editable | ||||
|         ? props.content | ||||
|         : findDOMNode(contentRef.value)?.innerText; | ||||
|     } | ||||
| 
 | ||||
|     // =============== Expand =============== | ||||
|  | @ -324,7 +327,7 @@ const Base = defineComponent({ | |||
|       if ( | ||||
|         !rows || | ||||
|         rows < 0 || | ||||
|         !contentRef.value?.$el || | ||||
|         !findDOMNode(contentRef.value) || | ||||
|         state.expanded || | ||||
|         props.content === undefined | ||||
|       ) | ||||
|  | @ -338,7 +341,7 @@ const Base = defineComponent({ | |||
|         text, | ||||
|         ellipsis: ell, | ||||
|       } = measure( | ||||
|         contentRef.value?.$el, | ||||
|         findDOMNode(contentRef.value), | ||||
|         { rows, suffix }, | ||||
|         props.content, | ||||
|         renderOperations(true), | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ const TITLE_ELE_LIST = tupleNum(1, 2, 3, 4, 5); | |||
| 
 | ||||
| export const titleProps = () => ({ | ||||
|   ...omit(baseProps(), ['component', 'strong']), | ||||
|   level: Number as PropType<typeof TITLE_ELE_LIST[number]>, | ||||
|   level: Number as PropType<(typeof TITLE_ELE_LIST)[number]>, | ||||
| }); | ||||
| 
 | ||||
| export type TitleProps = Partial<ExtractPropTypes<ReturnType<typeof titleProps>>>; | ||||
|  | @ -16,7 +16,7 @@ export type TitleProps = Partial<ExtractPropTypes<ReturnType<typeof titleProps>> | |||
| const Title: FunctionalComponent<TitleProps> = (props, { slots, attrs }) => { | ||||
|   const { level = 1, ...restProps } = props; | ||||
|   let component: string; | ||||
|   if (TITLE_ELE_LIST.indexOf(level) !== -1) { | ||||
|   if (TITLE_ELE_LIST.includes(level)) { | ||||
|     component = `h${level}`; | ||||
|   } else { | ||||
|     warning(false, 'Typography', 'Title only accept `1 | 2 | 3 | 4 | 5` as `level` value.'); | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ category: Components | |||
| type: General | ||||
| title: Typography | ||||
| cols: 1 | ||||
| cover: https://gw.alipayobjects.com/zos/alicdn/GOM1KQ24O/Typography.svg | ||||
| cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*MLt3R6m9huoAAAAAAAAAAAAADrJ8AQ/original | ||||
| --- | ||||
| 
 | ||||
| Basic text writing, including headings, body text, lists, and more. | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ subtitle: 排版 | |||
| type: 通用 | ||||
| title: Typography | ||||
| cols: 1 | ||||
| cover: https://gw.alipayobjects.com/zos/alicdn/GOM1KQ24O/Typography.svg | ||||
| cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*MLt3R6m9huoAAAAAAAAAAAAADrJ8AQ/original | ||||
| --- | ||||
| 
 | ||||
| 文本的基本格式。 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 tangjinzhou
						tangjinzhou