Files
laws-sinotruk-client/src/components/InternalDetailPage.vue
T
2023-11-03 17:07:28 +08:00

136 lines
2.8 KiB
Vue

<template>
<a-spin :spinning="loading">
<div class="detail-container">
<div class="page-title">
<slot name="customIcon" v-if="customIcon" />
<i class="iconfont icon-chexiao" v-else @click="handleBack" />
<div class="page-title-text">
{{ title }}
<a-tooltip v-if="subTitleTooltip">
<template slot="title">{{ subTitle }}</template>
<div class="page-title-sub-title">{{ subTitle }}</div>
</a-tooltip>
<div class="page-title-sub-title" v-else>{{ subTitle }}</div>
</div>
<div class="custom-operate">
<slot name="titleRightCustom"></slot>
</div>
</div>
<div class="detail-content" :style="{padding: contentPadding + 'px'}">
<slot></slot>
</div>
</div>
</a-spin>
</template>
<script>
export default {
name: 'InternalDetailPage',
props: {
// 页面标题
title: {
type: String,
required: false,
default: null
},
// 是否需要自定义返回方法
needCustomBackFunc: {
type: Boolean,
required: false,
default: false
},
// 内容的内边距,默认是24
contentPadding: {
type: Number,
required: false,
default: 24
},
loading: {
type: Boolean,
required: false,
default: false
},
// 自定义图标
customIcon: {
type: Boolean,
required: false,
default: false
},
// 副标题
subTitle: {
type: String,
required: false,
default: null
},
// 副标题是否需要tooltip
subTitleTooltip: {
type: Boolean,
required: false,
default: false
}
},
methods: {
handleBack () {
if (this.needCustomBackFunc) {
this.$emit('back')
return
}
this.$router.go(-1)
}
}
}
</script>
<style scoped lang="less">
@import "~@/assets/less/common";
.detail-container {
height: @page-content-h;
background-color: white;
}
.page-title {
height: 56px;
border-bottom: 1px solid #E5E6EB;
padding: 0 24px;
display: flex;
align-items: center;
.iconfont {
font-size: 24px;
color: @primary-color;
cursor: pointer;
margin-right: 12px;
}
&-text {
font-size: 16px;
font-family: PingFang SC-Medium, PingFang SC, sans-serif;
font-weight: bold;
color: #1D2129;
flex: 1;
width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: flex;
align-items: center;
}
&-sub-title {
font-size: 16px;
font-family: PingFang SC-Regular, PingFang SC, sans-serif;
font-weight: 400;
color: #4E5969;
margin-left: 12px;
display: inline-block;
}
}
.detail-content {
height: calc(100% - 56px);
overflow: auto;
}
</style>