小程序一些常见问题
1、 解析链接时会因为带空格解析不到,需要去空格
1)、去掉所有空格
str=str.replace(/\s+/g,"");
2)、去掉两头空格
str=str.replace(/^\s+|\s+$/g,"");//js去掉两头空格
3)、去做空格
str=str.replace( /^\s*/, ''); //js去掉左空格
4)、去右空格
str=str.replace(/(\s*$)/g, ""); //js去掉右空格
2、使用了闭包计数,怎么销毁
在不使用的时候另变量等于null
3、自定义头部
在app.json window 增加 navigationStyle:custom
4、订阅消息只能放在点击事件里,不能放在回调函数里
5、分享微信好友和授权手机号码功能只能用button,去掉button的默认样式:
<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" class="shareZi" ></button>
.shareZi{
background-color: transparent !important;
}
.shareZi::after{
border: none;
}

浙公网安备 33010602011771号