v3.5.16小程序首页动画
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import Taro from '@tarojs/taro';
|
||||
import { HOME_SPLASH_BOTTLE_URL } from '@dukang/shared-types';
|
||||
|
||||
/** 冷启动会话内是否已播过首页开场(进程级,切 Tab 不重播) */
|
||||
|
||||
let played = false;
|
||||
|
||||
export function hasHomeSplashPlayed() {
|
||||
return played;
|
||||
}
|
||||
|
||||
export function markHomeSplashPlayed() {
|
||||
played = true;
|
||||
}
|
||||
|
||||
/** 冷启动预拉 OSS 开场图(仅 weapp;H5 的 getImageInfo 会走 CORS) */
|
||||
export function prefetchHomeSplashAssets() {
|
||||
if (played) return;
|
||||
if (process.env.TARO_ENV !== 'weapp') return;
|
||||
void Taro.getImageInfo({ src: HOME_SPLASH_BOTTLE_URL }).catch(() => {});
|
||||
}
|
||||
Reference in New Issue
Block a user