增加部分样式,公共方法,增加保存员工登录保存商户号

This commit is contained in:
2024-10-16 14:14:30 +08:00
parent e0f0d90bae
commit a5c0ab54cc
4 changed files with 40 additions and 7 deletions

View 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
}