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.
15 lines
492 B
15 lines
492 B
/**
|
|
* @description: 查询节点信息
|
|
* @param {String} selector 选择器
|
|
* @param {Boolean} isAll 是否选择全部,默认否
|
|
* @return {Promise}
|
|
* @example: this.$getRect('#wrap').then(rect=>{})
|
|
* @example: this.$getRect('.item',true).then(rects=>{})
|
|
*/
|
|
export default function getRect(selector, isAll) {
|
|
return new Promise(resolve => {
|
|
uni.createSelectorQuery().in(this)[isAll ? 'selectAll' : 'select'](selector)
|
|
.boundingClientRect(resolve)
|
|
.exec();
|
|
});
|
|
}
|
|
|