1: Calculate the adaptive image size according to the screen size ratio
2: According to the screen size ratio, according to the fixed height/width of the picture, the size conversion px/rpx/upx
data: {
// 此处的160是以rpx作为单位
codeHeight: 160
}
wx.getSystemInfo({
success: res => {
// 设备的宽高
let windowWidth = res.windowWidth;
// 根据rpx换算px的方法,例如iphone6 1rpx = 0.5px ,则windoScale=0.5
let windowScale = Math.floor(windowWidth/750*100)/100;
this.setData({
// codeHeight: parseInt( 160rpx * 0.5 ) = 80px
codeHeight: parseInt( this.data.codeHeight * windowScale)
})
}
})
Conversion method
equipment | Convert device rpx to px (screen width/750) | Convert device rpx to px (750/screen width) |
---|---|---|
iphone 5 | 1rpx = 0.42px | 1px = 2.32rpx |
iphone 6 | 1rpx = 0.5px | 1px = 2rpx |
iphone 6s | 1rpx = 0.552px | 1px = 1.81rpx |
3. "The upload of the mini program failed, prompting an illegal plug-in version":
Prompt information:
Error: illegal plugin version, plugin[BSTCommon] require minmum version[1.0.11] and your version[1.1.5][20201224 15:27:16][wxc596896532366]
Change the version of the plug-in BSTCommon to the corresponding version (1.0.11)
For example:
in app.json
"usingComponents": {},
"plugins": {
"BSTCommon": {
"version": "1.0.11",
"provider": "wx3f99db061dbc1dd3"
}
}
4. "The preview of the mini program can only be previewed by the developer WeChat", just add the developer to the WeChat mini program
https://mp.weixin.qq.com/wxamp/user/manage?action=index&use_role=1&token=995740640&lang=zh_CN
5. "Mini Program Plug-in":
Plug-in market: WeChat service platform
To add a plug-in in the developer tools:
1. Log in to the applet
2. Go to Settings -> Third-Party Settings -> Plug-in Management -> Add Plug-in -> Search for the corresponding plug-in name