mirror of
https://github.com/element-plus/element-plus.git
synced 2025-02-17 11:49:41 +08:00
refactor(components): [popover] use useNamespace (#5727)
This commit is contained in:
parent
f194efca96
commit
23c7c7843e
@ -17,7 +17,7 @@
|
||||
</template>
|
||||
|
||||
<template #content>
|
||||
<div v-if="title" class="el-popover__title" role="title">
|
||||
<div v-if="title" :class="ns.e('title')" role="title">
|
||||
{{ title }}
|
||||
</div>
|
||||
<slot>
|
||||
@ -31,6 +31,7 @@ import { defineComponent, computed, ref, unref } from 'vue'
|
||||
import ElTooltip from '@element-plus/components/tooltip'
|
||||
import { useDeprecateAppendToBody } from '@element-plus/components/popper'
|
||||
import { isString } from '@element-plus/utils'
|
||||
import { useNamespace } from '@element-plus/hooks'
|
||||
import { usePopoverProps } from './popover'
|
||||
|
||||
import type { StyleValue } from 'vue'
|
||||
@ -47,6 +48,7 @@ export default defineComponent({
|
||||
props: usePopoverProps,
|
||||
emits,
|
||||
setup(props, { emit }) {
|
||||
const ns = useNamespace('popover')
|
||||
const tooltipRef = ref<InstanceType<typeof ElTooltip> | null>(null)
|
||||
const popperRef = computed(() => {
|
||||
return unref(tooltipRef)?.popperRef
|
||||
@ -68,11 +70,7 @@ export default defineComponent({
|
||||
})
|
||||
|
||||
const kls = computed(() => {
|
||||
return [
|
||||
{ 'el-popover--plain': !!props.content },
|
||||
'el-popover',
|
||||
props.popperClass,
|
||||
]
|
||||
return [ns.b(), props.popperClass, { [ns.m('plain')]: !!props.content }]
|
||||
})
|
||||
|
||||
const { compatTeleported } = useDeprecateAppendToBody(
|
||||
@ -94,6 +92,7 @@ export default defineComponent({
|
||||
|
||||
return {
|
||||
compatTeleported,
|
||||
ns,
|
||||
kls,
|
||||
style,
|
||||
tooltipRef,
|
||||
|
Loading…
Reference in New Issue
Block a user