| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <template>
- <div class="custom-header" :style="{ background: bgColor, color: titleColor }">
- <div class="home" @click="goHome" v-if="showHome">
- <el-icon size="20" class="icon" :color="iconColor"><HomeFilled /></el-icon>
- </div>
- <div class="back" @click="goback" v-else-if="!isClose">
- <el-icon class="icon" :color="iconColor"><ArrowLeftBold /></el-icon>
- </div>
- <div class="close" @click="close" v-else-if="isClose && showClose">
- <el-icon class="icon" :color="iconColor"><CloseBold /></el-icon>
- </div>
- <div class="title">{{name}}</div>
- </div>
- </template>
- <script setup>
- import { useRouter} from "vue-router";
- import { ArrowLeftBold, CloseBold, HomeFilled } from "@element-plus/icons-vue";
- const router = useRouter();
- const props = defineProps({
- name:{
- type:String,
- defalut:''
- },
- bgColor:{
- type:String,
- defalut:'#151516'
- },
- /** 返回/关闭图标颜色 */
- iconColor: {
- type: String,
- default: "#fff",
- },
- /** 标题文字颜色 */
- titleColor: {
- type: String,
- default: "#FFFFFF",
- },
- isGoBack:{
- type:Boolean,
- defalut:false
- },
- isClose:{
- type:Boolean,
- defalut:false
- },
- showClose:{
- type:Boolean,
- defalut: true
- },
- /** 分享进页:左侧显示首页图标,点击进 growth_report */
- showHome: {
- type: Boolean,
- default: false,
- },
- })
- const emit = defineEmits(['close', "goback", "home"])
- const goback = () => {
- if(!props.isGoBack){
- router.go(-1);
- }else{
- emit('goback')
- }
- };
- const close = () => {
- emit('close')
- }
- const goHome = () => {
- emit("home");
- router.replace("/growth_report");
- }
- </script>
- <style lang="scss" scoped>
- .custom-header{
- background: #151516;
- width: 100%;
- height: 40px;
- font-size: 17px;
- display: flex;
- justify-content: center;
- align-items: center;
- position: relative;
- z-index: 12;
- .back,.close,.home{
- display: flex;
- align-items: center;
- color: #fff;
- position: absolute;
- left: 12px;
- z-index: 10;
- }
- .title{
- font-weight: 600;
- font-size: 17px;
- }
- }
- </style>
|