feat:完整布局封装

This commit is contained in:
MTrun
2022-01-06 13:45:51 +08:00
parent 1afc06b079
commit df1fccffa7
17 changed files with 236 additions and 15 deletions
@@ -0,0 +1,3 @@
import ContentBox from './index.vue'
export { ContentBox }
@@ -0,0 +1,101 @@
<template>
<div class="go-content-box" :class="[`bg-depth${depth}`, flex && 'flex']">
<div v-if="showTop" class="top go-mt-0">
<n-text> {{ title }} </n-text>
<n-space>
<slot name="top-right"></slot>
<n-icon size="20" class="go-cursor-pointer">
<ChevronBackOutlineIcon />
</n-icon>
</n-space>
</div>
<aside class="content">
<n-scrollbar x-scrollable>
<n-scrollbar>
<slot></slot>
</n-scrollbar>
</n-scrollbar>
</aside>
<div v-if="showBottom" class="bottom go-mt-0">
<slot name="bottom"></slot>
</div>
</div>
</template>
<script setup lang="ts">
import { icon } from '@/plugins'
const { ChevronBackOutlineIcon } = icon.ionicons5
defineProps({
title: String,
showTop: {
type: Boolean,
default: true
},
showBottom: {
type: Boolean,
default: false
},
flex: {
type: Boolean,
default: false
},
// 背景深度
depth: {
type: Number,
default: 1
}
})
</script>
<style lang="scss" scoped>
$topHeight: 36px;
@include go(content-box) {
height: calc(100vh - #{$--header-height});
margin: 1px;
margin-bottom: 0;
&.bg-depth0 {
@include filter-bg-color('background-color1');
.bottom,
.top {
@include filter-bg-color('background-color1');
}
}
&.bg-depth1 {
@include filter-bg-color('background-color1');
.bottom,
.top {
@include filter-bg-color('background-color2');
}
}
&.bg-depth2 {
@include filter-bg-color('background-color2');
.bottom,
.top {
@include filter-bg-color('background-color3');
}
}
&.bg-depth3 {
@include filter-bg-color('background-color3');
.bottom,
.top {
@include filter-bg-color('background-color4');
}
}
&.flex {
flex: 1;
}
.top,
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
height: 36px;
padding: 0 10px;
}
.content {
height: calc(100vh - #{$--header-height} - #{$topHeight});
overflow: hidden;
}
}
</style>
@@ -0,0 +1,3 @@
import ContentCharts from './index.vue'
export { ContentCharts }
@@ -0,0 +1,20 @@
<template>
<ContentBox class="go-content-charts" title="图表" :depth="2">
<n-scrollbar></n-scrollbar>
</ContentBox>
</template>
<script setup lang="ts">
import { reactive } from 'vue'
import { renderIcon } from '@/utils'
import { icon } from '@/plugins'
const {} = icon.ionicons5
import { ContentBox } from '../ContentBox/index'
</script>
<style lang="scss" scoped>
$wight: 200px;
@include go(content-charts) {
width: $wight;
}
</style>
@@ -0,0 +1,3 @@
import ContentDetails from './index.vue'
export { ContentDetails }
@@ -0,0 +1,13 @@
<template>
</template>
<script setup lang="ts">
import { reactive } from 'vue'
import { renderIcon } from '@/utils'
import { icon } from '@/plugins'
const { } = icon.ionicons5
</script>
<style lang="scss" scoped>
</style>
@@ -0,0 +1,3 @@
import ContentDraw from './index.vue'
export { ContentDraw }
@@ -0,0 +1,25 @@
<template>
<ContentBox
class="go-content-draw"
:flex="true"
:showTop="false"
:showBottom="true"
:depth="2"
>
<template #bottom>
</template>
</ContentBox>
</template>
<script setup lang="ts">
import { reactive } from 'vue'
import { ContentBox } from '../ContentBox/index'
</script>
<style lang="scss" scoped>
@include go(content-draw) {
overflow: hidden;
@include background-point('background-point');
@extend .go-point-bg;
}
</style>
@@ -0,0 +1,3 @@
import ContentLayers from './index.vue'
export { ContentLayers }
@@ -0,0 +1,18 @@
<template>
<ContentBox class="go-content-layers" title="图层"> </ContentBox>
</template>
<script setup lang="ts">
import { reactive } from 'vue'
import { renderIcon } from '@/utils'
import { icon } from '@/plugins'
const {} = icon.ionicons5
import { ContentBox } from '../ContentBox/index'
</script>
<style lang="scss" scoped>
$wight: 200px;
@include go(content-layers) {
width: $wight;
}
</style>
+10 -2
View File
@@ -12,8 +12,13 @@
<HeaderRightBtn />
</template>
</HeaderPro>
<n-layout-content>
<n-space></n-space>
<n-layout-content content-style="overflow:hidden; display: flex">
<!-- <n-space :size="2">
</n-space> -->
<ContentLayers />
<ContentCharts />
<ContentDraw />
</n-layout-content>
</n-layout>
</div>
@@ -24,6 +29,9 @@ import { HeaderPro } from '@/layout/components/HeaderPro'
import { HeaderLeftBtn } from './components/HeaderLeftBtn/index'
import { HeaderRightBtn } from './components/HeaderRightBtn/index'
import { HeaderTitle } from './components/HeaderTitle/index'
import { ContentLayers } from './components/ContentLayers/index'
import { ContentCharts } from './components/ContentCharts/index'
import { ContentDraw } from './components/ContentDraw/index'
</script>
<style lang="scss" scoped>
@@ -68,7 +68,7 @@ $siderHeight: 100vh;
@include go(project) {
&-sider {
@include filter-bg-color('aside-background_color');
@include filter-bg-color('aside-background-color');
&-top {
display: flex;
align-items: center;