求教:config里面的window 如何按照多端判断
-
import Taro, { Component, Config } from '@tarojs/taro' import './app.scss' import './constant/global' var new_window = {}; if (process.env.TARO_ENV === 'alipay') { new_window = { "transparentTitle": "none" , "titlePenetrate":"NO", } console.log(new_window); } if (process.env.TARO_ENV === 'weapp') { console.log(1111); new_window.navigationStyle = 'custom'; console.log(new_window); } class App extends Component { config: Config = { pages: [ 'pages/home/index', 'pages/business/index', 'pages/service/index', 'pages/user/index', ], window: new_window, tabBar: { "custom": true, "color": "#999999", "selectedColor": "#222222", "borderStyle": "white", "list": [{ "selectedIconPath": "static/images/a1h.png", "iconPath": "static/images/a1.png", "pagePath": "pages/home/index", "text": "首页" }, { "selectedIconPath": "static/images/a2h.png", "iconPath": "static/images/a2.png", "pagePath": "pages/business/index", "text": "业务" }, { "selectedIconPath": "static/images/a3h.png", "iconPath": "static/images/a3.png", "pagePath": "pages/service/index", "text": "服务" }, { "selectedIconPath": "static/images/a4h.png", "iconPath": "static/images/a4.png", "pagePath": "pages/user/index", "text": "我的" }] }, "permission": { "scope.userLocation": { "desc": "你的位置信息将用于附近商家的展示" } } } componentWillMount() { //this.configInit(); //这里隐藏支付宝的顶部tabBar if (process.env.TARO_ENV === 'alipay') { Taro.hideTabBar({ animation: false }) } } componentDidShow() { } componentDidHide() { } componentDidCatchError() { } // this.props.children 是将要会渲染的页面 render() { return this.props.children } } export default App
config里面的window 如何按照多端判断,我这样写是无效的