#ifdef MP-WEIXIN<标识> 标识适配不同端
#ifdef MP-WEIXIN //适配微信端
如果想要自定义导航栏,则需要在pages.json中配置属性transparentTitle设置为auto和navigationStyle设置为custom
"style": {
"navigationBarTitleText": "客服中心",
// #ifndef MP-TOUTIAO
"transparentTitle":"auto",
"navigationStyle": "custom",
// #endif
//支付宝禁止下拉
"allowsBounceVertical":"NO",
//微信禁止下拉
"enablePullDownRefresh": false
// "disableScroll": true
}
抖音自定义导航栏比较严重,所以需要适配才行,这里使用// #ifndef MP-TOUTIAO即可,其意思就是除抖音之外的
#ifndef是if not define的简写
{
"path": "pages/my/index",
"style": {
"navigationBarTitleText": "我的",
// #ifndef MP-TOUTIAO
"transparentTitle":"auto",
"navigationStyle": "custom",
// #endif
//支付宝禁止下拉
"allowsBounceVertical":"NO",
//微信禁止下拉
"enablePullDownRefresh": false,
"disableScroll": true
}
},
// #endif 就是结尾标识,相当于闭合标签
完整代码示例
//适配抖音、头条
//适配微信
//适配支付宝
//适配除了抖音、头条之外的
本文由 用户 于 2024-04-02 发布在 金钥匙,如有疑问,请联系我们。
本文链接:https://www.51969.com/post/17824986.html
发表评论