Files
ba_web/src/components/aboutTable/PageTitle.vue

67 lines
1.4 KiB
Vue
Raw Normal View History

2025-09-22 09:01:41 +08:00
<template>
<div class="pageTitle" :style="`margin-bottom: ${marginBottom}px;background-color: ${backgroundColor}`">
<div class="title">
2025-09-22 17:16:42 +08:00
<div class="font" v-if="typeof title === 'string'">{{ title }}</div>
<ul v-else class="flex" style="align-items: center;">
<el-button @click="handleClick(item,index)" :type="active == index ? 'primary':''" v-for="(item, index) in title" :key="index">{{ item }}</el-button>
</ul>
2025-09-22 09:01:41 +08:00
</div>
<div class="cnetr">
<slot name="center"></slot>
</div>
<div class="right">
<slot> </slot>
</div>
</div>
</template>
<script setup>
2025-09-22 17:16:42 +08:00
import { ref ,defineEmits} from 'vue';
2025-09-22 09:01:41 +08:00
defineProps({
title: {
2025-09-22 17:16:42 +08:00
type: String || Array,
default: "" || []
2025-09-22 09:01:41 +08:00
},
2025-09-22 17:16:42 +08:00
active:{
type: Number,
default: 0
}, //下标
2025-09-22 09:01:41 +08:00
marginBottom: {
type: Number,
default: 0
},
backgroundColor: {
type: String,
default: "rgb(255, 255, 255, 0)"
}
});
2025-09-22 17:16:42 +08:00
const emit = defineEmits(['change','update:active']);
function handleClick (item,index){
emit('update:active',index);
emit('change',item)
}
2025-09-22 09:01:41 +08:00
</script>
<style lang = "scss" scoped>
.pageTitle {
width: 100%;
padding: 10px 0;
border-radius: 6px;
display: flex;
justify-content: space-between;
align-items: center;
min-height: 52px;
.title {
display: flex;
margin: auto 0;
.icon {
margin: auto 0;
}
.font {
vertical-align: middle;
font-size: 18px;
}
}
}
2025-09-22 17:16:42 +08:00
2025-09-22 09:01:41 +08:00
</style>