修改UI问题初
This commit is contained in:
@@ -43,6 +43,7 @@ import WhyChoose from './components/WhyChoose.vue'
|
||||
import CompanyIntro from './components/CompanyIntro.vue'
|
||||
|
||||
import { getCountries, getGoods } from '@/api/public.js'
|
||||
import { buildUrl } from '@/api/request.js'
|
||||
import { truncateProductTitle } from '@/utils/product.js'
|
||||
|
||||
import {
|
||||
@@ -81,6 +82,7 @@ export default {
|
||||
}
|
||||
},
|
||||
async onLoad() {
|
||||
this.loadGlobalFont()
|
||||
await this.loadPodCountries()
|
||||
await this.loadPodProducts('')
|
||||
},
|
||||
@@ -96,6 +98,19 @@ export default {
|
||||
this.stopAutoPlay()
|
||||
},
|
||||
methods: {
|
||||
// 全局加载苹方子集字体(常用3500字+数字英文,约700KB)
|
||||
// 必须在页面加载后调用(App onLaunch 里页面未创建会报 not font page)
|
||||
// family 用自定义名 PingFangSC(避免与系统苹方重名),已加到 app.css 字体栈首位;global: true 全局生效
|
||||
// 加载失败自动回退系统字体,不影响使用
|
||||
loadGlobalFont() {
|
||||
uni.loadFontFace({
|
||||
global: true,
|
||||
family: 'PingFangSC',
|
||||
source: `url("${buildUrl('/assets/miniprogram/fonts/PingFang-Regular.subset.ttf')}")`,
|
||||
success: () => console.log('字体加载成功'),
|
||||
fail: err => console.warn('字体加载失败,回退系统字体', err)
|
||||
})
|
||||
},
|
||||
async loadPodCountries() {
|
||||
try {
|
||||
const res = await getCountries()
|
||||
|
||||
Reference in New Issue
Block a user