真机效果
开发者工具效果
想要的效果是弹窗底部和屏幕底部紧贴着
// 头像、昵称弹窗
show_modal: function (params) {
var that = this;
var show_modal = that.data.show_modal;
var result = that.data.result;
var animation = wx.createAnimation({
duration: 500,
timingFunction: 'ease'
});
if (show_modal == true) {
show_modal = false;
animation.translateY('0%').step()
} else {
show_modal = true;
animation.translateY('-120%').step()
}
that.setData({
show_modal,
nickname: result['nickname'],
ani: animation.export()
})
},
谢谢大佬
获取到设备窗口信息然后按比例就行适配https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getWindowInfo.html
为啥translateY(-120%)?
建议代码贴出来
https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html