72 lines
1.8 KiB
TypeScript
72 lines
1.8 KiB
TypeScript
import { Component, ReactNode } from "react";
|
|
import Taro from "@tarojs/taro";
|
|
import "./nutui-theme.scss";
|
|
import "./app.scss";
|
|
import "./scss/qweather-icons/qweather-icons.css";
|
|
import { useGlobalStore } from "./store/global";
|
|
import { removeStorage } from "./store/storage";
|
|
|
|
interface AppProps {
|
|
children: ReactNode;
|
|
}
|
|
|
|
function clearSpecStorage() {
|
|
removeStorage('list_reload_page_number')
|
|
removeStorage('backFlag')
|
|
}
|
|
|
|
class App extends Component<AppProps> {
|
|
onLaunch(options) {
|
|
console.log('launch options: ', options)
|
|
console.log("小程序启动,初始化逻辑写这里");
|
|
clearSpecStorage()
|
|
Taro.onNeedPrivacyAuthorization((resolve) => {
|
|
// 这里可以自定义弹窗(或直接默认同意)
|
|
resolve({ event: 'agree' }); // 同意隐私协议
|
|
});
|
|
|
|
// Taro.loadFontFace({
|
|
// family: 'Quicksand',
|
|
// source: 'url("https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/other/57dc951f-f10e-45b7-9157-0b1e468187fd.ttf")',
|
|
// global: true, // 全局生效
|
|
// success(res) {
|
|
// console.log('字体加载成功', res);
|
|
// },
|
|
// fail(err) {
|
|
// console.error('字体加载失败', err);
|
|
// }
|
|
// })
|
|
}
|
|
|
|
componentDidMount() {
|
|
// 初始化字典数据
|
|
this.getNavBarHeight();
|
|
// this.getLocation()
|
|
}
|
|
|
|
componentDidShow() { }
|
|
|
|
componentDidHide() { }
|
|
|
|
|
|
|
|
// 获取导航高度
|
|
getNavBarHeight = () => {
|
|
const { getNavbarHeightInfo } = useGlobalStore.getState();
|
|
getNavbarHeightInfo();
|
|
};
|
|
|
|
// 获取位置信息
|
|
// getLocation = () => {
|
|
// const { getCurrentLocationInfo } = useGlobalStore.getState()
|
|
// getCurrentLocationInfo()
|
|
// }
|
|
|
|
render() {
|
|
// this.props.children 是将要会渲染的页面
|
|
return this.props.children;
|
|
}
|
|
}
|
|
|
|
export default App;
|