You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
683 B
JavaScript
23 lines
683 B
JavaScript
6 months ago
|
export const basic = Behavior({
|
||
|
methods: {
|
||
|
$emit() {
|
||
|
this.triggerEvent.apply(this, arguments);
|
||
|
},
|
||
|
getRect(selector, all) {
|
||
|
return new Promise(resolve => {
|
||
|
wx.createSelectorQuery()
|
||
|
.in(this)[all ? 'selectAll' : 'select'](selector)
|
||
|
.boundingClientRect(rect => {
|
||
|
if (all && Array.isArray(rect) && rect.length) {
|
||
|
resolve(rect);
|
||
|
}
|
||
|
if (!all && rect) {
|
||
|
resolve(rect);
|
||
|
}
|
||
|
})
|
||
|
.exec();
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
});
|