mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-21 01:02:59 +08:00
refactor(components): [page-header] use useNamespace (#5724)
This commit is contained in:
parent
fae48c8817
commit
d210f267ac
@ -1,16 +1,16 @@
|
||||
<template>
|
||||
<div class="el-page-header">
|
||||
<div class="el-page-header__left" @click="handleClick">
|
||||
<div v-if="icon || $slots.icon" class="el-page-header__icon">
|
||||
<div :class="ns.b()">
|
||||
<div :class="ns.e('left')" @click="handleClick">
|
||||
<div v-if="icon || $slots.icon" :class="ns.e('icon')">
|
||||
<slot name="icon">
|
||||
<el-icon v-if="icon"><component :is="icon" /></el-icon>
|
||||
</slot>
|
||||
</div>
|
||||
<div class="el-page-header__title">
|
||||
<div :class="ns.e('title')">
|
||||
<slot name="title">{{ title || t('el.pageHeader.title') }}</slot>
|
||||
</div>
|
||||
</div>
|
||||
<div class="el-page-header__content">
|
||||
<div :class="ns.e('content')">
|
||||
<slot name="content">{{ content }}</slot>
|
||||
</div>
|
||||
</div>
|
||||
@ -19,7 +19,7 @@
|
||||
import { defineComponent } from 'vue'
|
||||
import { ElIcon } from '@element-plus/components/icon'
|
||||
|
||||
import { useLocale } from '@element-plus/hooks'
|
||||
import { useLocale, useNamespace } from '@element-plus/hooks'
|
||||
import { pageHeaderEmits, pageHeaderProps } from './page-header'
|
||||
|
||||
export default defineComponent({
|
||||
@ -34,6 +34,7 @@ export default defineComponent({
|
||||
|
||||
setup(_, { emit }) {
|
||||
const { t } = useLocale()
|
||||
const ns = useNamespace('page-header')
|
||||
|
||||
function handleClick() {
|
||||
emit('back')
|
||||
@ -42,6 +43,7 @@ export default defineComponent({
|
||||
return {
|
||||
handleClick,
|
||||
t,
|
||||
ns,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user