Просмотр исходного кода

fix: 新增 chart 顶部按钮

MTrun 3 лет назад
Родитель
Сommit
2194ca5cd6

+ 5 - 0
src/layout/components/HeaderPro/index.vue

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

+ 10 - 4
src/plugins/icon.ts

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

+ 1 - 1
src/styles/common/mixins/mixins.scss

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

+ 11 - 6
src/views/chart/index.vue

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

+ 3 - 0
src/views/chart/layout/components/HeaderLeftBtn/index.ts

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

+ 39 - 0
src/views/chart/layout/components/HeaderLeftBtn/index.vue

@@ -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>

+ 3 - 0
src/views/chart/layout/components/HeaderRightBtn/index.ts

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

+ 37 - 0
src/views/chart/layout/components/HeaderRightBtn/index.vue

@@ -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>

+ 0 - 1
src/views/project/index.vue

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

+ 2 - 2
src/views/project/items/components/Card/index.vue

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