fix: 新增 chart 顶部按钮

This commit is contained in:
MTrun 2022-01-05 18:04:41 +08:00
parent d9641d6690
commit 2194ca5cd6
10 changed files with 111 additions and 14 deletions

View File

@ -1,9 +1,14 @@
<template> <template>
<Header> <Header>
<template #left>
<slot name="left"></slot>
</template>
<template #ri-left> <template #ri-left>
<slot name="ri-left"></slot>
</template> </template>
<template #ri-right> <template #ri-right>
<UserInfo /> <UserInfo />
<slot name="ri-right"></slot>
</template> </template>
</Header> </Header>
</template> </template>

View File

@ -7,7 +7,7 @@ import {
Trash as TrashIcon, Trash as TrashIcon,
Pencil as PencilIcon, Pencil as PencilIcon,
HammerOutline as HammerIcon, HammerOutline as HammerIcon,
ApertureSharp as ApertureSharpIcon, DesktopOutline as DesktopOutlineIcon,
DownloadOutline as DownloadIcon, DownloadOutline as DownloadIcon,
Open as OpenIcon, Open as OpenIcon,
Send as SendIcon, Send as SendIcon,
@ -29,7 +29,9 @@ import {
CodeSlash as CodeSlashIcon, CodeSlash as CodeSlashIcon,
Duplicate as DuplicateIcon, Duplicate as DuplicateIcon,
DuplicateOutline as DuplicateOutlineIcon, DuplicateOutline as DuplicateOutlineIcon,
Fish as FishIcon Fish as FishIcon,
BarChart as BarChartIcon,
Albums as AlbumsIcon
} from '@vicons/ionicons5' } from '@vicons/ionicons5'
// ionicons5 在这里 // ionicons5 在这里
@ -73,7 +75,7 @@ const ionicons5 = {
// 编辑2锤子 // 编辑2锤子
HammerIcon, HammerIcon,
// 预览 // 预览
ApertureSharpIcon, DesktopOutlineIcon,
// 下载 // 下载
DownloadIcon, DownloadIcon,
// 导出 // 导出
@ -95,7 +97,11 @@ const ionicons5 = {
// 语言 // 语言
LanguageIcon, LanguageIcon,
// 新项目(鱼) // 新项目(鱼)
FishIcon FishIcon,
// 图表
BarChartIcon,
// 图层
AlbumsIcon
} }
// https://www.xicons.org/#/ 还有很多 // https://www.xicons.org/#/ 还有很多

View File

@ -10,7 +10,7 @@
} }
@mixin deep() { @mixin deep() {
::v-deep { :deep {
@content; @content;
} }
} }

View File

@ -1,11 +1,16 @@
<template> <template>
<div class="go-chart"> <div class="go-chart">
<n-layout> <n-layout>
<HeaderPro /> <HeaderPro>
<template #left>
<HeaderLeftBtn />
</template>
<template #ri-left>
<HeaderRightBtn />
</template>
</HeaderPro>
<n-layout-content> <n-layout-content>
<TransitionMain>
<router-view />
</TransitionMain>
</n-layout-content> </n-layout-content>
</n-layout> </n-layout>
</div> </div>
@ -13,8 +18,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { HeaderPro } from '@/layout/components/HeaderPro' import { HeaderPro } from '@/layout/components/HeaderPro'
import { requireFallbackImg } from '@/utils' import { HeaderLeftBtn } from './layout/components/HeaderLeftBtn/index'
import { TransitionMain } from '@/layout/components/TransitionMain/index' import { HeaderRightBtn } from './layout/components/HeaderRightBtn/index'
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -0,0 +1,3 @@
import HeaderLeftBtn from './index.vue'
export { HeaderLeftBtn }

View File

@ -0,0 +1,39 @@
<template>
<n-space>
<n-tooltip
v-for="item in btnList"
:key="item.title"
placement="bottom"
trigger="hover"
>
<template #trigger>
<n-button type="info" size="small" ghost>
<component :is="item.icon"></component>
</n-button>
</template>
<span>
{{ item.title }}
</span>
</n-tooltip>
</n-space>
</template>
<script setup lang="ts">
import { reactive } from 'vue'
import { icon } from '@/plugins'
const { AlbumsIcon, BarChartIcon } = icon.ionicons5
import { renderIcon } from '@/utils'
const btnList = reactive([
{
select: true,
title: '图层控制',
icon: renderIcon(AlbumsIcon)
},
{
select: true,
title: '图表组件',
icon: renderIcon(BarChartIcon)
}
])
</script>

View File

@ -0,0 +1,3 @@
import HeaderRightBtn from './index.vue'
export { HeaderRightBtn }

View File

@ -0,0 +1,37 @@
<template>
<n-space class="go-mt-0">
<n-button v-for="item in btnList" :key="item.title" ghost>
<template #icon>
<component :is="item.icon"></component>
</template>
<span>
{{ item.title }}
</span>
</n-button>
</n-space>
</template>
<script setup lang="ts">
import { reactive } from 'vue'
import { renderIcon } from '@/utils'
import { icon } from '@/plugins'
const { DesktopOutlineIcon, SendIcon } = icon.ionicons5
const btnList = reactive([
{
select: true,
title: '预览',
icon: renderIcon(DesktopOutlineIcon)
},
{
select: true,
title: '发布',
icon: renderIcon(SendIcon)
}
])
</script>
<style lang="scss" scoped>
.align-center {
margin-top: -4px;
}
</style>

View File

@ -25,7 +25,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { Sider } from './layout/components/Sider' import { Sider } from './layout/components/Sider'
// import { Header } from './layout/components/Header/index'
import { HeaderPro } from '@/layout/components/HeaderPro' import { HeaderPro } from '@/layout/components/HeaderPro'
import { TransitionMain } from '@/layout/components/TransitionMain/index' import { TransitionMain } from '@/layout/components/TransitionMain/index'
</script> </script>

View File

@ -95,7 +95,7 @@ const {
CopyIcon, CopyIcon,
TrashIcon, TrashIcon,
PencilIcon, PencilIcon,
ApertureSharpIcon, DesktopOutlineIcon,
DownloadIcon, DownloadIcon,
HammerIcon, HammerIcon,
SendIcon SendIcon
@ -126,7 +126,7 @@ const selectOptions = reactive([
{ {
label: t('global.r_preview'), label: t('global.r_preview'),
key: 'preview', key: 'preview',
icon: renderIcon(ApertureSharpIcon) icon: renderIcon(DesktopOutlineIcon)
}, },
{ {
label: t('global.r_copy'), label: t('global.r_copy'),