basic.js
656 字节
import { classNames } from '../common/class-names';
export var basic = Behavior({
methods: {
classNames: classNames,
$emit: function $emit() {
this.triggerEvent.apply(this, arguments);
},
getRect: function getRect(selector, all) {
var _this = this;
return new Promise(function (resolve) {
wx.createSelectorQuery().in(_this)[all ? 'selectAll' : 'select'](selector).boundingClientRect(function (rect) {
if (all && Array.isArray(rect) && rect.length) {
resolve(rect);
}
if (!all && rect) {
resolve(rect);
}
}).exec();
});
}
}
});