微信小程序隐藏变量

小程序 About 5,895 words

隐藏变量

在微信开发者工具中,可以打开Console控制台,输入__双下划线,会有代码提示,这些__开头的变量就是微信小程序的内置变量。

注意

随着版本更迭,需要主要这些隐藏变量是否被移除,注意不同版本。

举例

__wxConfig

{
    "pages": [
        "index/index",
        "index/index2"
    ],
    "tabBar": {
        "custom": true,
        "color": "#7A7E83",
        "selectedColor": "#3cc51f",
        "borderStyle": "black",
        "backgroundColor": "#ffffff",
        "list": [
            {
                "pagePath": "index/index.html",
                "iconPath": "/image/icon_component.png",
                "selectedIconPath": "/image/icon_component_HL.png",
                "text": "组件"
            },
            {
                "pagePath": "index/index2.html",
                "iconPath": "/image/icon_API.png",
                "selectedIconPath": "/image/icon_API_HL.png",
                "text": "接口"
            }
        ]
    },
    "window": {
        "backgroundTextStyle": "light",
        "navigationBarBackgroundColor": "#fff",
        "navigationBarTitleText": "WeChat",
        "navigationBarTextStyle": "black"
    },
    "resizable": false,
    "debug": false,
    "widgets": [],
    "customClose": false,
    "workers": "",
    "cloud": false,
    "global": {
        "window": {
            "backgroundColor": "#ffffff",
            "backgroundTextStyle": "light",
            "navigationBarBackgroundColor": "#fff",
            "navigationBarTitleText": "WeChat",
            "navigationBarTextStyle": "black"
        }
    },
    "networkTimeout": {
        "request": 60000,
        "uploadFile": 60000,
        "connectSocket": 60000,
        "downloadFile": 60000
    },
    "ext": {},
    "extAppid": "",
    "mainPlugins": {},
    "useExtendedLib": {},
    "supportedMaterials": [],
    "renderer": {
        "default": "webview",
        "allUsed": [
            "webview"
        ]
    },
    "requiredPrivateInfos": [],
    "__warning__": "",
    "entryPagePath": "index/index.html",
    "publibSupportLazyload": true,
    "isLazyLoad": false,
    "appType": 0,
    "urlCheck": true,
    "wxAppInfo": {
        "maxRequestConcurrent": 10,
        "maxUploadConcurrent": 10,
        "maxDownloadConcurrent": 10,
        "maxWorkerConcurrent": 1,
        "maxWebsocketConnect": 2
    },
    "opConfig": {
        "expt_info": {
            "expt_param_list": []
        }
    },
    "appContactInfo": {
        "passThroughInfo": {
            "forceUpdate": false
        },
        "stablePassThroughInfo": {
            "wxa_privacy_list": [],
            "wxa_open_url_domain_list": []
        },
        "operationInfo": {
            "jsonInfo": {
                "apiAvailable": {
                    "authorize": 1,
                    "bluetoothContactAndCanlanderNeedAuth": 0,
                    "gameSceneFromMyApp": 1,
                    "getUserInfo": 1,
                    "h5PayDisableForward": 0,
                    "navigateToMiniProgram": 1,
                    "navigateToMiniProgramConfig": 1,
                    "openData": 0,
                    "openSetting": 1,
                    "screenCanvasReadPixelsFreely": 1,
                    "share": 1,
                    "shareCustomImageUrl": 1
                },
                "bgKeepAlive": {
                    "music": 1
                },
                "jumpWeAppFromLongPressCodeBanInfo": {
                    "banJumpApp": 0,
                    "banJumpGame": 0
                },
                "misc_ban_info": {
                    "minigame_freeze_status": 0
                },
                "privacy": {
                    "banGetWifiListIfEmptyDesc": 0,
                    "banLocationIfEmptyDesc": 0
                },
                "wxaAppSwitch": {
                    "userProfile": 1
                },
                "navigate_ban_info": {
                    "navigate_ban_rule_list": [],
                    "do_report": 0
                },
                "op_info": {
                    "grow_protect": 1
                },
                "vod_config": {
                    "domain_pattern": "15\\d+\\.(vod-qcloud|vod2.myqcloud)\\.com\\/|\\w+\\.vod\\.wxamedia\\.com\\/",
                    "trace_secret": ""
                },
                "warning_info": {
                    "jsapi_alter": []
                }
            }
        }
    },
    "host": {
        "env": "WeChat"
    },
    "accountInfo": {
        "appId": "appId",
        "nickname": "测试号",
        "icon": "https://mmbiz.qpic.cn/mmbiz_png/icTdbqWNOwNQ0ia79enzYJBsZ3CIkLQGe39qeOxbpT9oM9KaCthzBa0PF75xzBGjZQGlM69TDggxpNX7ACibCjjtw/0?wx_fmt=png"
    },
    "platform": "devtools",
    "appLaunchInfo": {
        "scene": 1001,
        "path": "index/index",
        "query": {},
        "mode": "default",
        "appearance": "default"
    },
    "env": {
        "USER_DATA_PATH": "http://usr"
    },
    "envVersion": "develop",
    "brand": "devtools",
    "model": "iPhone 12/13 mini",
    "pixelRatio": 3,
    "system": "iOS 10.0.1",
    "version": "8.0.5",
    "language": "zh",
    "screenWidth": 375,
    "screenHeight": 812,
    "exportBaseMethods": false,
    "networkType": "wifi",
    "serverMode": {
        "switch": false
    },
    "isIsolateContext": true
}

wxAppCode

{
    "components/navigation-bar/navigation-bar.json": {
        "component": true,
        "styleIsolation": "apply-shared",
        "usingComponents": {}
    },
    "miniprogram_npm/my-view/index.json": {
        "component": true,
        "usingComponents": {}
    },
    "pages/index/index.json": {
        "usingComponents": {
            "navigation-bar": "/components/navigation-bar/navigation-bar",
            "r-oauth2": "/miniprogram_npm/my-view/index"
        },
        "disableScroll": true,
        "navigationStyle": "custom"
    }
}

wxAppCurrentFile

miniprogram_npm/my-view/index.js

__wxAppData

{
    "pages/index/index": {
        "__webviewId__": 5
    }
}
Views: 532 · Posted: 2024-02-07

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh