优化 预览稿件时图片加载慢导致无法显示
This commit is contained in:
parent
c1a7bee638
commit
f30c3f233a
|
|
@ -59,7 +59,7 @@ import {
|
|||
mergeDeepObject, objectHasKey,
|
||||
} from "@/components/DraftDesign/utils/FuncUtil";
|
||||
|
||||
import {register, getTeleport} from '@antv/x6-vue-shape'
|
||||
import {register} from '@antv/x6-vue-shape'
|
||||
|
||||
import './icons/style.css'
|
||||
|
||||
|
|
@ -169,8 +169,6 @@ const regNode = () => {
|
|||
})
|
||||
}
|
||||
}
|
||||
const TeleportContainer = defineComponent(getTeleport());
|
||||
|
||||
// @ts-nocheck
|
||||
const emit = defineEmits(["save"])
|
||||
const {t} = useI18n() // 国际化
|
||||
|
|
@ -699,25 +697,28 @@ const toPngUrl = (callback: (url: string) => void, options?: {
|
|||
bottom: number
|
||||
}
|
||||
}) => {
|
||||
let widthScale = options && options.widthScale ? options.widthScale : 5
|
||||
let heightScale = options && options.heightScale ? options.heightScale : 5
|
||||
|
||||
graph.toPNG((dataUri) => {
|
||||
that.previewUrl = dataUri;
|
||||
callback(that.previewUrl)
|
||||
}, {
|
||||
backgroundColor: that.pageConfig.background.areaColor,
|
||||
width: that.pageConfig.width * (widthScale),
|
||||
height: that.pageConfig.height * (heightScale),
|
||||
padding: {
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0
|
||||
},
|
||||
quality: 1,
|
||||
...options
|
||||
})
|
||||
setTimeout(()=>{
|
||||
//处理图片等待加载完成
|
||||
let widthScale = options && options.widthScale ? options.widthScale : 5
|
||||
let heightScale = options && options.heightScale ? options.heightScale : 5
|
||||
graph.toPNG((dataUri) => {
|
||||
that.previewUrl = dataUri;
|
||||
callback(that.previewUrl)
|
||||
}, {
|
||||
backgroundColor: that.pageConfig.background.areaColor,
|
||||
width: that.pageConfig.width * (widthScale),
|
||||
height: that.pageConfig.height * (heightScale),
|
||||
padding: {
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0
|
||||
},
|
||||
quality: 1,
|
||||
...options
|
||||
})
|
||||
},500)
|
||||
}
|
||||
const setPropList = (propDataInfo) => {
|
||||
const keys = Object.keys(propDataInfo)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ export function calcDpiFromSize( screenSize=16,opt = 'd'){
|
|||
}
|
||||
const tmpImage = {}
|
||||
export function convertImageToBase64(url) {
|
||||
return new Promise(async (resolve, reject)=>{
|
||||
return new Promise(async (resolve)=>{
|
||||
FileApi.getDomain().then(async (domain) => {
|
||||
url = replaceDomain(domain, url)
|
||||
if(tmpImage[url]){
|
||||
|
|
|
|||
Loading…
Reference in New Issue