mirror of
https://gitee.com/dromara/go-view.git
synced 2025-02-24 08:12:49 +08:00
commit
cb54b1f51f
18
src/packages/components/Informations/Mores/Iframe/config.ts
Normal file
18
src/packages/components/Informations/Mores/Iframe/config.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { PublicConfigClass } from '@/packages/public'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import { IframeConfig } from './index'
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
|
||||
export const option = {
|
||||
// 网站路径
|
||||
dataset: "https://www.bilibili.com/",
|
||||
// 圆角
|
||||
borderRadius: 10
|
||||
}
|
||||
|
||||
export default class Config extends PublicConfigClass implements CreateComponentType
|
||||
{
|
||||
public key = IframeConfig.key
|
||||
public chartConfig = cloneDeep(IframeConfig)
|
||||
public option = cloneDeep(option)
|
||||
}
|
36
src/packages/components/Informations/Mores/Iframe/config.vue
Normal file
36
src/packages/components/Informations/Mores/Iframe/config.vue
Normal file
@ -0,0 +1,36 @@
|
||||
<template>
|
||||
<collapse-item name="属性" :expanded="true">
|
||||
<setting-item-box name="路径" :alone="true">
|
||||
<setting-item>
|
||||
<n-input v-model:value="optionData.dataset" size="small"></n-input>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<setting-item-box name="样式">
|
||||
<setting-item name="圆角">
|
||||
<n-input-number
|
||||
v-model:value="optionData.borderRadius"
|
||||
size="small"
|
||||
:min="0"
|
||||
placeholder="圆角"
|
||||
></n-input-number>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType } from "vue";
|
||||
import { option } from "./config";
|
||||
import {
|
||||
CollapseItem,
|
||||
SettingItemBox,
|
||||
SettingItem,
|
||||
} from "@/components/Pages/ChartItemSetting";
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<typeof option>,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
</script>
|
15
src/packages/components/Informations/Mores/Iframe/index.ts
Normal file
15
src/packages/components/Informations/Mores/Iframe/index.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import image from '@/assets/images/chart/informations/photo.png'
|
||||
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
|
||||
import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d'
|
||||
|
||||
export const IframeConfig: ConfigType = {
|
||||
key: 'Iframe',
|
||||
chartKey: 'VIframe',
|
||||
conKey: 'VCIframe',
|
||||
title: 'Iframe',
|
||||
category: ChatCategoryEnum.MORE,
|
||||
categoryName: ChatCategoryEnumName.MORE,
|
||||
package: PackagesCategoryEnum.INFORMATIONS,
|
||||
chartFrame: ChartFrameEnum.COMMON,
|
||||
image
|
||||
}
|
50
src/packages/components/Informations/Mores/Iframe/index.vue
Normal file
50
src/packages/components/Informations/Mores/Iframe/index.vue
Normal file
@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<div :style="getStyle(borderRadius)">
|
||||
<iframe :src="option.dataset" :width="w" :height="h"></iframe>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, shallowReactive, watch, toRefs } from "vue";
|
||||
import { useChartDataFetch } from "@/hooks";
|
||||
import { CreateComponentType } from "@/packages/index.d";
|
||||
import { useChartEditStore } from "@/store/modules/chartEditStore/chartEditStore";
|
||||
|
||||
const props = defineProps({
|
||||
chartConfig: {
|
||||
type: Object as PropType<CreateComponentType>,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const { w, h } = toRefs(props.chartConfig.attr);
|
||||
const { dataset, borderRadius } = toRefs(props.chartConfig.option);
|
||||
|
||||
const option = shallowReactive({
|
||||
dataset: "",
|
||||
});
|
||||
|
||||
const getStyle = (radius: number) => {
|
||||
return {
|
||||
borderRadius: `${radius}px`,
|
||||
overflow: "hidden",
|
||||
};
|
||||
};
|
||||
|
||||
// 编辑更新
|
||||
watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
(newData: any) => {
|
||||
option.dataset = newData;
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: false,
|
||||
}
|
||||
);
|
||||
|
||||
// 预览更新
|
||||
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => {
|
||||
option.dataset = newData;
|
||||
});
|
||||
</script>
|
@ -1,5 +1,6 @@
|
||||
import { ImageConfig } from './Image/index'
|
||||
import { IframeConfig } from './Iframe/index'
|
||||
import { VideoConfig } from './Video/index'
|
||||
import { WordCloudConfig } from './WordCloud/index'
|
||||
|
||||
export default [ImageConfig, VideoConfig, WordCloudConfig]
|
||||
export default [ImageConfig, VideoConfig, WordCloudConfig,IframeConfig]
|
||||
|
Loading…
Reference in New Issue
Block a user