2022-08-16 23:30:23 +08:00
|
|
|
<template>
|
|
|
|
<div class="main-box">
|
|
|
|
<div class="content-container__header" v-if="slots.header || header">
|
|
|
|
<slot name="header">
|
|
|
|
<back-button
|
|
|
|
:path="backPath"
|
|
|
|
:name="backName"
|
|
|
|
:to="backTo"
|
|
|
|
:header="header"
|
2022-11-23 11:34:44 +08:00
|
|
|
:reload="reload"
|
2022-08-16 23:30:23 +08:00
|
|
|
v-if="showBack"
|
|
|
|
></back-button>
|
2022-11-23 11:34:44 +08:00
|
|
|
<!-- <el-page-header @back="reload" v-if="showBack" :content="header"></el-page-header> -->
|
2022-09-09 11:20:02 +08:00
|
|
|
<span v-else>{{ header }}</span>
|
2022-08-16 23:30:23 +08:00
|
|
|
</slot>
|
|
|
|
</div>
|
|
|
|
<div class="content-container__toolbar" v-if="slots.toolbar">
|
|
|
|
<slot name="toolbar"></slot>
|
|
|
|
</div>
|
|
|
|
<div class="content-container_form">
|
|
|
|
<slot name="form">
|
|
|
|
<form-button>
|
|
|
|
<slot name="button"></slot>
|
|
|
|
</form-button>
|
|
|
|
</slot>
|
|
|
|
</div>
|
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { computed, useSlots } from 'vue';
|
|
|
|
import BackButton from '@/components/back-button/index.vue';
|
|
|
|
import FormButton from './form-button.vue';
|
|
|
|
defineOptions({ name: 'LayoutContent' }); // 组件名
|
|
|
|
const slots = useSlots();
|
|
|
|
const prop = defineProps({
|
|
|
|
header: String,
|
|
|
|
backPath: String,
|
|
|
|
backName: String,
|
|
|
|
backTo: Object,
|
2022-11-23 11:34:44 +08:00
|
|
|
reload: Boolean,
|
2022-08-16 23:30:23 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
const showBack = computed(() => {
|
2022-11-23 11:34:44 +08:00
|
|
|
const { backPath, backName, backTo, reload } = prop;
|
|
|
|
return backPath || backName || backTo || reload;
|
2022-08-16 23:30:23 +08:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
@use '@/styles/mixins.scss' as *;
|
|
|
|
|
|
|
|
.content-container__header {
|
|
|
|
font-weight: 700;
|
|
|
|
padding: 5px 0 25px;
|
|
|
|
font-size: 18px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.content-container__toolbar {
|
|
|
|
@include flex-row(space-between, center);
|
|
|
|
margin-bottom: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.content-container_form {
|
|
|
|
text-align: -webkit-center;
|
|
|
|
width: 60%;
|
|
|
|
margin-left: 15%;
|
|
|
|
.form-button {
|
|
|
|
float: right;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|