fix(嵌入式): 上传自定义字体,在添加了 content-path 路径的情况下,div 嵌入数据大屏会提示字体请求不到

This commit is contained in:
dataeaseShu
2024-12-02 16:57:01 +08:00
parent 40404f29c0
commit 5fa386e821

View File

@@ -175,7 +175,9 @@ export const useAppearanceStore = defineStore('appearanceStore', {
fontStyleElement.innerHTML = `@font-face {
font-family: '${name}';
src: url(${
embeddedStore.baseUrl ? embeddedStore.baseUrl : basePath
embeddedStore.baseUrl
? (embeddedStore.baseUrl + basePath).replace('/./', '/')
: basePath
}/typeface/download/${currentFont.fileTransName});
font-weight: normal;
font-style: normal;
@@ -212,9 +214,11 @@ export const useAppearanceStore = defineStore('appearanceStore', {
defaultFont().then(res => {
const [font] = res || []
setDefaultFont(
`${embeddedStore.baseUrl ? embeddedStore.baseUrl : basePath}/typeface/download/${
font?.fileTransName
}`,
`${
embeddedStore.baseUrl
? (embeddedStore.baseUrl + basePath).replace('/./', '/')
: basePath
}/typeface/download/${font?.fileTransName}`,
font?.name,
font?.fileTransName
)