增加部分样式,公共方法,增加保存员工登录保存商户号
This commit is contained in:
26
commons/utils/safe-bottom.js
Normal file
26
commons/utils/safe-bottom.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import {
|
||||
getCurrentInstance,
|
||||
} from 'vue';
|
||||
export function getElRect(elClass, dataVal) {
|
||||
const instance = getCurrentInstance();
|
||||
return new Promise((resolve, reject) => {
|
||||
const query = uni.createSelectorQuery().in(instance.proxy);
|
||||
query.select('.' + elClass).fields({
|
||||
size: true
|
||||
}, res => {
|
||||
// 如果节点尚未生成,res值为null,循环调用执行
|
||||
if (!res) {
|
||||
setTimeout(() => {
|
||||
getElRect(elClass);
|
||||
}, 10);
|
||||
return;
|
||||
}
|
||||
resolve(res);
|
||||
}).exec();
|
||||
})
|
||||
}
|
||||
|
||||
export async function getSafeBottomHeight(className, height = 16) {
|
||||
const bottomEle = await getElRect(className)
|
||||
return bottomEle.height + height
|
||||
}
|
||||
Reference in New Issue
Block a user