小程序ios键盘字数限制input的maxlength在有问题
ios端汉字输入拼音 会被当作length
从而一旦超过了max-length, 于是,键盘上汉字还没拼出来 就已经输入不了,解决方法:去掉maxlength,使用bindinput方法
<input type="text" bindinput="inputChange" />
// 输入框值
inputChange(e) {
let text = e.detail.value.trim()
this.setData({
name:text.substring(0,10)
})
}
window.open(url),url是动态地址
pc端、安卓机打开没有问题,ios打开跳转不了,原因:浏览器为了避免弹出广告影响用户,禁用了通过代码调用超链接在新标签打开页面的功能,只能通过用户点击a链接或者关闭浏览器的防止弹框功能,或者提前获取了文件地址
方法一
const url= await api()
a.setAttribute('href', url)
document.body.appendChild(a)
a.click()
a.remove()
方法二
<a :href="url">跳转地址</a>
input type="file"
ios正常,安卓在其他平台都是可以正常唤起相册选择,但是在浙里办中扫码打开不行,原因:accept值为.png、.jpg等,需去掉multiple并且accept修改为image/png,image/jpg
string.replaceAll()
ios正常,安卓不兼容replaceAll方法,建议改用replace
钉钉小程序webview 部分机型不加载url
token存在空格、参数中存在中文,解决方法:使用encodeURIComponent编译一下有问题的参数