You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
518 B
26 lines
518 B
const promisic = function (func) {
|
|
return function (params = {}) {
|
|
return new Promise((resolve, reject) => {
|
|
const args = Object.assign(params, {
|
|
success: (res) => {
|
|
resolve(res);
|
|
},
|
|
fail: (error) => {
|
|
reject(error);
|
|
}
|
|
});
|
|
func(args);
|
|
});
|
|
};
|
|
};
|
|
|
|
const px2rpx = function (pxNumber) {
|
|
const { screenWidth } = wx.getSystemInfoSync();
|
|
return (750 / screenWidth) * pxNumber;
|
|
};
|
|
|
|
export {
|
|
promisic,
|
|
px2rpx
|
|
};
|