From c878581cee97b8bfe6c2b000f6d874abca8a3e26 Mon Sep 17 00:00:00 2001 From: "@thinkinggis" Date: Mon, 10 Oct 2022 16:28:42 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20css=20=E6=89=93=E5=8C=85=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E5=86=85=E8=81=94=20(#1375)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 文件名大小写 * fix: font load 逻辑 * fix: font 加载问题 * fix: lint error * fix: css lib 打包配置 --- packages/component/.fatherrc.ts | 1 + .../core/src/services/asset/FontService.ts | 37 ++++++++++--------- packages/maps/.fatherrc.ts | 2 + 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/packages/component/.fatherrc.ts b/packages/component/.fatherrc.ts index 1bb7f40993..586f65b4c4 100644 --- a/packages/component/.fatherrc.ts +++ b/packages/component/.fatherrc.ts @@ -6,6 +6,7 @@ export default { cjs: { output:'lib' }, + platform:'browser', autoprefixer: { browsers: ['IE 11', 'last 2 versions'], }, diff --git a/packages/core/src/services/asset/FontService.ts b/packages/core/src/services/asset/FontService.ts index 0c790145d5..53c1b7cb9c 100644 --- a/packages/core/src/services/asset/FontService.ts +++ b/packages/core/src/services/asset/FontService.ts @@ -172,26 +172,27 @@ export default class FontService extends EventEmitter implements IFontService { url('${fontPath}') format('woff'), url('${fontPath}') format('truetype'); }`; - document.getElementsByTagName('head')[0].appendChild(style); - style.onload=()=>{ - if ( document.fonts) { - try { - // @ts-ignore - document.fonts.load(`24px ${fontFamily}`, 'L7text'); - document.fonts.ready.then(()=>{ - this.emit('fontloaded',{ - fontFamily - }) - }) - - } catch (e) { - console.warn('当前环境不支持 document.fonts !'); - console.warn('当前环境不支持 iconfont !'); - console.warn(e); + style.onload=()=>{ + if ( document.fonts) { + try { + // @ts-ignore + document.fonts.load(`24px ${fontFamily}`, 'L7text'); + document.fonts.ready.then(()=>{ + this.emit('fontloaded',{ + fontFamily + }) + }) + + } catch (e) { + console.warn('当前环境不支持 document.fonts !'); + console.warn('当前环境不支持 iconfont !'); + console.warn(e); + } + } + } - } + document.getElementsByTagName('head')[0].appendChild(style); - } } public destroy(): void { diff --git a/packages/maps/.fatherrc.ts b/packages/maps/.fatherrc.ts index 1bb7f40993..8ba43fc58a 100644 --- a/packages/maps/.fatherrc.ts +++ b/packages/maps/.fatherrc.ts @@ -4,8 +4,10 @@ export default { output:'es' }, cjs: { + output:'lib' }, + platform:'browser', autoprefixer: { browsers: ['IE 11', 'last 2 versions'], },