fix: 修改key

This commit is contained in:
mtruning 2022-01-16 22:17:34 +08:00
parent 5550e75893
commit d54c9d2388
36 changed files with 130 additions and 86 deletions

View File

@ -1,3 +1,12 @@
import LoadingComponent from './index.vue';
import type { App } from 'vue'
import LoadingComponent from './index.vue'
import AsyncLoading from './index.vue'
export { LoadingComponent };
// 正常组件
export { LoadingComponent }
// 异步
AsyncLoading.install = (app: App): void => {
app.component('AsyncLoading', AsyncLoading)
}
export { AsyncLoading }

View File

@ -1,6 +1,6 @@
<template>
<div>
<Skeleton repeat="3" :load="true"/>
<Skeleton :repeat="3" :load="true"/>
</div>
</template>

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const BarCommonConfig: ConfigType = {
key: 'BarCommon',
key: 'VBarCommon',
title: '柱状图',
category: ChatCategoryEnum.BAR,
node: BarCommon,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const BarCrossrangefig: ConfigType = {
key: 'BarCrossrange',
key: 'VBarCrossrange',
title: '横向柱状图',
category: ChatCategoryEnum.BAR,
node: BarCrossrange,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const LineCommonConfig: ConfigType = {
key: 'LineCommon',
key: 'VLineCommon',
title: '折线图',
category: ChatCategoryEnum.LINE,
node: LineCommon,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const LineGradientSingleConfig: ConfigType = {
key: 'LineGradientSingle',
key: 'VLineGradientSingle',
title: '折线面积图',
category: ChatCategoryEnum.LINE,
node: LineGradientSingle,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const LineGradientsConfig: ConfigType = {
key: 'LineGradientSingle',
key: 'VLineGradientSingle',
title: '折线面积图',
category: ChatCategoryEnum.LINE,
node: LineGradients,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const MapChineConfig: ConfigType = {
key: 'MapChine',
key: 'VMapChine',
title: '北京地图',
category: ChatCategoryEnum.MAP,
node: MapChine,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const FunnelConfig: ConfigType = {
key: 'Funnel',
key: 'VFunnel',
title: '漏斗图',
category: ChatCategoryEnum.MORE,
node: Funnel,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const HeatmapConfig: ConfigType = {
key: 'Heatmap',
key: 'VHeatmap',
title: '热力图',
category: ChatCategoryEnum.MORE,
node: Heatmap,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const PointConfig: ConfigType = {
key: 'Point',
key: 'VPoint',
title: '热力图',
category: ChatCategoryEnum.MORE,
node: Point,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const RadarConfig: ConfigType = {
key: 'Radar',
key: 'VRadar',
title: '雷达',
category: ChatCategoryEnum.MORE,
node: Radar,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const TreeMapConfig: ConfigType = {
key: 'TreeMap',
key: 'VTreeMap',
title: '树形分布',
category: ChatCategoryEnum.MORE,
node: TreeMap,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const VariableConfig: ConfigType = {
key: 'Variable',
key: 'VVariable',
title: '折线面积图',
category: ChatCategoryEnum.MORE,
node: Variable,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const PieCommonConfig: ConfigType = {
key: 'PieCommon',
key: 'VPieCommon',
title: '计量图',
category: ChatCategoryEnum.PIE,
node: PieCommon,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const NumberConfig: ConfigType = {
key: 'Number',
key: 'VNumber',
title: '数字翻牌',
category: ChatCategoryEnum.MORE,
node: Number,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const TimeConfig: ConfigType = {
key: 'Time',
key: 'VTime',
title: '时间',
category: ChatCategoryEnum.MORE,
node: Time,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const WeatherConfig: ConfigType = {
key: 'Weather',
key: 'VWeather',
title: '天气',
category: ChatCategoryEnum.MORE,
node: Weather,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const WeatherTimeConfig: ConfigType = {
key: 'WeatherTime',
key: 'VWeatherTime',
title: '天气和时间',
category: ChatCategoryEnum.MORE,
node: WeatherTime,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const BorderCommonConfig: ConfigType = {
key: 'BorderCommon',
key: 'VBorderCommon',
title: '边框',
category: ChatCategoryEnum.BORDER,
node: BorderCommon,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const ImageConfig: ConfigType = {
key: 'Image',
key: 'VImage',
title: '图片',
category: ChatCategoryEnum.MORE,
node: Image,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const TextCloudConfig: ConfigType = {
key: 'TextCloud',
key: 'VTextCloud',
title: '词云',
category: ChatCategoryEnum.MORE,
node: TextCloud,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const TextCommonConfig: ConfigType = {
key: 'Text',
key: 'VText',
title: '文字',
category: ChatCategoryEnum.TEXT,
node: TextCommon,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const TitleBevelAngleConfig: ConfigType = {
key: 'TitleBevelAngle',
key: 'VTitleBevelAngle',
title: '斜角标题',
category: ChatCategoryEnum.TITLE,
node: TitleBevelAngle,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const TitleCommonConfig: ConfigType = {
key: 'Text',
key: 'VText',
title: '普通标题',
category: ChatCategoryEnum.TITLE,
node: TitleCommon,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../../index.d'
export const TitleProConfig: ConfigType = {
key: 'TitlePro',
key: 'VTitlePro',
title: '中心标题',
category: ChatCategoryEnum.TITLE,
node: TitlePro,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../index.d'
export const TableCategoryConfig: ConfigType = {
key: 'TableCategory',
key: 'VTableCategory',
title: '归类表格',
category: ChatCategoryEnum.table,
node: TableCategory,

View File

@ -4,7 +4,7 @@ import { ConfigType } from '@/packages/index.d'
import { ChatCategoryEnum } from '../index.d'
export const TableCommonConfig: ConfigType = {
key: 'TableCommon',
key: 'VTableCommon',
title: '表格',
category: ChatCategoryEnum.table,
node: TableCommon,

View File

View File

@ -58,7 +58,7 @@ export const useChartLayoutStore = defineStore({
;(this as any)[key] = value
setLocalStorage(GO_CHART_LAYOUT_STORE, this.$state)
},
setFilter<T extends keyof ChartLayoutType>(key: T, value: boolean): void {
setFilter<T extends keyof ChartLayoutFilterType>(key: T, value: boolean): void {
;(this.filter as any)[key] = value
setLocalStorage(GO_CHART_LAYOUT_STORE, this.$state)
},

14
src/utils/componets.ts Normal file
View File

@ -0,0 +1,14 @@
import { defineAsyncComponent, AsyncComponentLoader } from 'vue'
import { AsyncLoading } from '@/components/LoadingComponent'
/**
* *
* @param loader
* @returns
*/
export const loadAsyncComponent = (loader: AsyncComponentLoader<any>) =>
defineAsyncComponent({
loader,
loadingComponent: AsyncLoading,
delay: 20,
})

View File

@ -4,7 +4,7 @@ import screenfull from 'screenfull'
import debounce from 'lodash/debounce'
/**
* * ID
* * ID
* @param { Number } randomLength
*/
export function getUUID(randomLength: number) {

View File

@ -1,76 +1,100 @@
<template>
<ContentBox
class="go-content-layers go-boderbox"
:class="{ scoped: !chartLayoutStore.getDetails }"
:showTop="false"
:depth="2"
>
<n-tabs class="tabs-box" size="small" type="segment">
<n-tab-pane
v-for="item in tabList"
:key="item.key"
:name="item.key"
display-directive="show:lazy"
>
<template #tab>
<n-space>
<span>{{ item.title }}</span>
<n-icon size="16" class="icon-position">
<component :is="item.icon"></component>
</n-icon>
</n-space>
</template>
<component :is="item.render"></component>
</n-tab-pane>
</n-tabs>
</ContentBox>
<n-layout has-sider sider-placement="right">
<n-layout-content>
<!-- 为了展示折叠的按钮放在了这里 呜呜呜 -->
<ContentDrag />
</n-layout-content>
<n-layout-sider
collapse-mode="transform"
:collapsed-width="0"
:width="350"
:collapsed="collapsed"
:native-scrollbar="false"
show-trigger="bar"
@collapse="collapsedHindle"
@expand="expandHindle"
>
<ContentBox class="go-content-layers go-boderbox" :showTop="false" :depth="2">
<n-tabs class="tabs-box" size="small" type="segment">
<n-tab-pane
v-for="item in tabList"
:key="item.key"
:name="item.key"
display-directive="show:lazy"
>
<template #tab>
<n-space>
<span>{{ item.title }}</span>
<n-icon size="16" class="icon-position">
<component :is="item.icon"></component>
</n-icon>
</n-space>
</template>
<component :is="item.render"></component>
</n-tab-pane>
</n-tabs>
</ContentBox>
</n-layout-sider>
</n-layout>
</template>
<script setup lang="ts">
import { reactive, shallowRef } from 'vue'
import { shallowRef, ref, toRefs, watch } from 'vue'
import { icon } from '@/plugins'
import { ContentBox } from '../ContentBox/index'
import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
import { ChartLayoutStoreEnums } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
import { Setting } from './components/Setting/index'
import { Behind } from './components/Behind/index'
import { ContentDrag } from '../ContentDrag/index'
const chartLayoutStore = useChartLayoutStore()
const { getDetails } = toRefs(useChartLayoutStore())
const { setItem } = useChartLayoutStore()
const { CubeIcon, FlashIcon } = icon.ionicons5
const tabList = reactive([
const collapsed = ref<boolean>(getDetails.value)
const collapsedHindle = () => {
collapsed.value = true
setItem(ChartLayoutStoreEnums.DETAILS, true)
}
const expandHindle = () => {
collapsed.value = false
setItem(ChartLayoutStoreEnums.DETAILS, false)
}
watch(getDetails, (newData) => {
if (newData) {
collapsedHindle()
} else {
expandHindle()
}
})
const tabList = shallowRef([
{
key: 'setting',
title: '配置项',
icon: CubeIcon,
render: shallowRef(Setting)
render: Setting
},
{
key: 'behind',
title: '后端数据',
icon: FlashIcon,
render: shallowRef(Behind)
render: Behind
}
])
</script>
<style lang="scss" scoped>
$wight: 400px;
@include go(content-layers) {
width: $wight;
padding: 10px;
overflow: hidden;
@extend .go-transition;
.icon-position {
padding-top: 2px;
}
&.scoped {
width: 0;
padding: 0;
}
.tabs-box {
/* padding 值 */
width: $wight - 2 * 10;
}
}
</style>

View File

@ -8,19 +8,9 @@
</template>
</n-button>
<n-space>
<n-tooltip
v-for="item in btnList"
:key="item.key"
placement="bottom"
trigger="hover"
>
<n-tooltip v-for="item in btnList" :key="item.key" placement="bottom" trigger="hover">
<template #trigger>
<n-button
:type="item.select ? 'success' : ''"
size="small"
ghost
@click="clickHandle(item)"
>
<n-button :type="styleHandle(item)" size="small" ghost @click="clickHandle(item)">
<component :is="item.icon"></component>
</n-button>
</template>
@ -69,6 +59,15 @@ const btnList = reactive<ItemType[]>([
}
])
// store ContentDetails collapsed
const styleHandle = (item: ItemType) => {
if (item.key === ChartLayoutStoreEnums.DETAILS) {
return item.select ? '' : 'success'
}
return item.select ? 'success' : ''
}
const clickHandle = (item: ItemType) => {
setItem(item.key, !item.select)
}

View File

@ -15,7 +15,6 @@
<n-layout-content content-style="overflow:hidden; display: flex">
<ContentCharts />
<ContentLayers />
<ContentDrag />
<ContentDetails />
</n-layout-content>
</n-layout>
@ -29,7 +28,6 @@ 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 { ContentDrag } from './components/ContentDrag/index'
import { ContentDetails } from './components/ContentDetails/index'
</script>