mirror of
https://gitee.com/dromara/go-view.git
synced 2025-10-13 14:02:10 +08:00
feat: 新增iframe组件
This commit is contained in:
parent
d07f25045c
commit
ae1219dea7
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,6 @@
|
|||||||
node_modules
|
node_modules
|
||||||
.DS_Store
|
.DS_Store
|
||||||
dist
|
customLargeScreen
|
||||||
dist-ssr
|
dist-ssr
|
||||||
*.local
|
*.local
|
||||||
.vscode
|
.vscode
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
export const OUTPUT_DIR = 'dist'
|
export const OUTPUT_DIR = 'customLargeScreen'
|
||||||
|
|
||||||
// monaco-editor 路径
|
// monaco-editor 路径
|
||||||
export const prefix = `monaco-editor/esm/vs`
|
export const prefix = `monaco-editor/esm/vs`
|
||||||
|
@ -6,7 +6,7 @@ import cloneDeep from 'lodash/cloneDeep'
|
|||||||
|
|
||||||
export const option = {
|
export const option = {
|
||||||
// 网站路径
|
// 网站路径
|
||||||
dataset: "https://www.mtruning.club/",
|
dataset: "",
|
||||||
// 圆角
|
// 圆角
|
||||||
borderRadius: 10
|
borderRadius: 10
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :style="getStyle(borderRadius)">
|
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<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 { useChartDataFetch } from '@/hooks'
|
||||||
import { CreateComponentType } from '@/packages/index.d'
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
|
import {debounce} from 'lodash'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
chartConfig: {
|
chartConfig: {
|
||||||
@ -20,9 +21,23 @@ const props = defineProps({
|
|||||||
const { w, h } = toRefs(props.chartConfig.attr)
|
const { w, h } = toRefs(props.chartConfig.attr)
|
||||||
const { borderRadius } = toRefs(props.chartConfig.option)
|
const { borderRadius } = toRefs(props.chartConfig.option)
|
||||||
|
|
||||||
const option = shallowReactive({
|
// const option = shallowReactive({
|
||||||
dataset: ''
|
// 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) => {
|
const getStyle = (radius: number) => {
|
||||||
return {
|
return {
|
||||||
@ -31,19 +46,19 @@ const getStyle = (radius: number) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑更新
|
// // 编辑更新
|
||||||
watch(
|
// watch(
|
||||||
() => props.chartConfig.option.dataset,
|
// () => props.chartConfig.option.dataset,
|
||||||
(newData: string) => {
|
// (newData: string) => {
|
||||||
option.dataset = newData
|
// option.dataset = newData
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
immediate: true
|
// immediate: true
|
||||||
}
|
// }
|
||||||
)
|
// )
|
||||||
|
|
||||||
// 预览更新
|
// // 预览更新
|
||||||
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: string) => {
|
// useChartDataFetch(props.chartConfig, useChartEditStore, (newData: string) => {
|
||||||
option.dataset = newData
|
// option.dataset = newData
|
||||||
})
|
// })
|
||||||
</script>
|
</script>
|
||||||
|
@ -5,4 +5,4 @@ import { VideoConfig } from './Video/index'
|
|||||||
import { WordCloudConfig } from './WordCloud/index'
|
import { WordCloudConfig } from './WordCloud/index'
|
||||||
|
|
||||||
// export default [VideoConfig]
|
// export default [VideoConfig]
|
||||||
export default []
|
export default [IframeConfig]
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PropType } from "vue/dist/vue";
|
import { PropType } from "vue";
|
||||||
import { option } from './config'
|
import { option } from './config'
|
||||||
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user