feat: 新增iframe组件

This commit is contained in:
huanghao1412 2024-03-07 17:41:01 +08:00
parent d07f25045c
commit ae1219dea7
6 changed files with 39 additions and 24 deletions

2
.gitignore vendored
View File

@ -1,6 +1,6 @@
node_modules
.DS_Store
dist
customLargeScreen
dist-ssr
*.local
.vscode

View File

@ -1,5 +1,5 @@
import path from 'path'
export const OUTPUT_DIR = 'dist'
export const OUTPUT_DIR = 'customLargeScreen'
// monaco-editor 路径
export const prefix = `monaco-editor/esm/vs`

View File

@ -6,7 +6,7 @@ import cloneDeep from 'lodash/cloneDeep'
export const option = {
// 网站路径
dataset: "https://www.mtruning.club/",
dataset: "",
// 圆角
borderRadius: 10
}

View File

@ -1,14 +1,15 @@
<template>
<div :style="getStyle(borderRadius)">
<iframe :src="option.dataset" :width="w" :height="h" style="border-width: 0"></iframe>
<iframe :src="src" :width="w" :height="h" allowfullscreen style="border-width: 0"></iframe>
</div>
</template>
<script setup lang="ts">
import { PropType, shallowReactive, watch, toRefs } from 'vue'
import { PropType, shallowReactive, watch, toRefs, ref, computed } from 'vue'
import { useChartDataFetch } from '@/hooks'
import { CreateComponentType } from '@/packages/index.d'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import {debounce} from 'lodash'
const props = defineProps({
chartConfig: {
@ -20,9 +21,23 @@ const props = defineProps({
const { w, h } = toRefs(props.chartConfig.attr)
const { borderRadius } = toRefs(props.chartConfig.option)
const option = shallowReactive({
dataset: ''
})
// const option = shallowReactive({
// dataset: ''
// })
let src = ref('')
const setValue = debounce((v: string) => {
src.value = v
}, 1000)
watch(
() => props.chartConfig.option.dataset,
(v: string) => {
setValue(v)
},
{
immediate: true
}
)
const getStyle = (radius: number) => {
return {
@ -31,19 +46,19 @@ const getStyle = (radius: number) => {
}
}
//
watch(
() => props.chartConfig.option.dataset,
(newData: string) => {
option.dataset = newData
},
{
immediate: true
}
)
// //
// watch(
// () => props.chartConfig.option.dataset,
// (newData: string) => {
// option.dataset = newData
// },
// {
// immediate: true
// }
// )
//
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: string) => {
option.dataset = newData
})
// //
// useChartDataFetch(props.chartConfig, useChartEditStore, (newData: string) => {
// option.dataset = newData
// })
</script>

View File

@ -5,4 +5,4 @@ import { VideoConfig } from './Video/index'
import { WordCloudConfig } from './WordCloud/index'
// export default [VideoConfig]
export default []
export default [IframeConfig]

View File

@ -14,7 +14,7 @@
</template>
<script setup lang="ts">
import { PropType } from "vue/dist/vue";
import { PropType } from "vue";
import { option } from './config'
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'