spring
14 小时以前 bddc56038852e18aa9454657a0bee58fae328405
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<template>
  <div class="page-header-wrapper">
    <el-page-header @back="handleBack" :content="content">
      <template #icon v-if="$slots.icon">
        <slot name="icon"></slot>
      </template>
      <template #title v-if="$slots.title">
        <slot name="title"></slot>
      </template>
      <template #content v-if="$slots.content">
        <slot name="content"></slot>
      </template>
      <template #extra>
        <slot name="extra">
          <slot name="right-button"></slot>
        </slot>
      </template>
    </el-page-header>
  </div>
</template>
 
<script setup>
import { useRouter } from 'vue-router'
 
const props = defineProps({
  content: {
    type: String,
    default: ''
  }
})
 
const emit = defineEmits(['back'])
 
const router = useRouter()
 
const handleBack = () => {
  emit('back')
  // 默认返回到上一级
  router.back()
}
</script>
 
<style scoped>
.page-header-wrapper {
  margin-bottom: 16px;
}
 
.page-header-wrapper :deep(.el-page-header__extra) {
  display: flex;
  align-items: center;
  gap: 8px;
}
</style>