| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <template>
- <div class="custom-header" :style="{background:bgColor}">
- <div class="back" @click="goback" v-if="!isClose">
- <el-icon class="icon" color="rgba(0, 0, 0, 0.9)"><ArrowLeftBold /></el-icon>
- </div>
- <div class="close" @click="close" v-if="isClose && showClose">
- <el-icon class="icon" color="rgba(0, 0, 0, 0.9)"><CloseBold /></el-icon>
- </div>
- <div class="title">{{name}}</div>
- </div>
- </template>
- <script setup>
- import { ref } from "vue";
- import { useRouter} from "vue-router";
- const router = useRouter();
- const props = defineProps({
- name:{
- type:String,
- defalut:''
- },
- bgColor:{
- type:String,
- defalut:'#fff'
- },
- isGoBack:{
- type:Boolean,
- defalut:false
- },
- isClose:{
- type:Boolean,
- defalut:false
- },
- showClose:{
- type:Boolean,
- defalut: true
- }
- })
- const emit = defineEmits(['close', "goback"])
- const goback = () => {
- if(!props.isGoBack){
- router.go(-1);
- }else{
- emit('goback')
- }
- };
- const close = () => {
- emit('close')
- }
- </script>
- <style lang="scss" scoped>
- .custom-header{
- background: #fff;
- width: 100%;
- height: 40px;
- font-size: 17px;
- display: flex;
- justify-content: center;
- align-items: center;
- position: relative;
- z-index: 12;
- .back,.close{
- display: flex;
- align-items: center;
- color: #656565;
- position: absolute;
- left: 12px;
- z-index: 10;
- }
- .title{
- font-weight: bold;
- }
- }
- </style>
|