mirror of
https://github.com/element-plus/element-plus.git
synced 2025-04-06 16:30:35 +08:00
refactor(components): [description, input] use the component name constant (#20107)
* refactor(components): [description] extracts the component name constant * refactor: extracts the component name constant * refactor: change the location of COMPONENT_NAME * Update packages/components/descriptions/src/description-item.ts Co-authored-by: btea <2356281422@qq.com> * refactor: change the name * refactor: Extract COMPONENT_NAME to a separate file * refactor: Adjust rows --------- Co-authored-by: btea <2356281422@qq.com>
This commit is contained in:
parent
4807705579
commit
e87a8670d4
1
packages/components/descriptions/src/constants.ts
Normal file
1
packages/components/descriptions/src/constants.ts
Normal file
@ -0,0 +1 @@
|
||||
export const COMPONENT_NAME = 'ElDescriptionsItem'
|
@ -1,5 +1,6 @@
|
||||
import { defineComponent } from 'vue'
|
||||
import { buildProps } from '@element-plus/utils'
|
||||
import { COMPONENT_NAME } from './constants'
|
||||
|
||||
import type { ExtractPropTypes, Slot, VNode } from 'vue'
|
||||
|
||||
@ -75,8 +76,9 @@ export const descriptionItemProps = buildProps({
|
||||
default: '',
|
||||
},
|
||||
})
|
||||
|
||||
const DescriptionItem = defineComponent({
|
||||
name: 'ElDescriptionsItem',
|
||||
name: COMPONENT_NAME,
|
||||
props: descriptionItemProps,
|
||||
})
|
||||
|
||||
|
@ -32,6 +32,7 @@ import { useFormSize } from '@element-plus/components/form'
|
||||
import ElDescriptionsRow from './descriptions-row.vue'
|
||||
import { descriptionsKey } from './token'
|
||||
import { descriptionProps } from './description'
|
||||
import { COMPONENT_NAME } from './constants'
|
||||
|
||||
import type { IDescriptionsInject } from './descriptions.type'
|
||||
import type { DescriptionItemVNode } from './description-item'
|
||||
@ -76,7 +77,7 @@ const getRows = () => {
|
||||
|
||||
const children = flattedChildren(slots.default()).filter(
|
||||
(node): node is DescriptionItemVNode =>
|
||||
(node as any)?.type?.name === 'ElDescriptionsItem'
|
||||
(node as any)?.type?.name === COMPONENT_NAME
|
||||
)
|
||||
const rows: DescriptionItemVNode[][] = []
|
||||
let temp: DescriptionItemVNode[] = []
|
||||
|
@ -197,8 +197,9 @@ import type { StyleValue } from 'vue'
|
||||
|
||||
type TargetElement = HTMLInputElement | HTMLTextAreaElement
|
||||
|
||||
const COMPONENT_NAME = 'ElInput'
|
||||
defineOptions({
|
||||
name: 'ElInput',
|
||||
name: COMPONENT_NAME,
|
||||
inheritAttrs: false,
|
||||
})
|
||||
const props = defineProps(inputProps)
|
||||
@ -502,7 +503,7 @@ watch(
|
||||
onMounted(() => {
|
||||
if (!props.formatter && props.parser) {
|
||||
debugWarn(
|
||||
'ElInput',
|
||||
COMPONENT_NAME,
|
||||
'If you set the parser, you also need to set the formatter.'
|
||||
)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user