可以使用getBoundingClientRect方法来获取组件位置,示例代码如下: queryBounds: function () {
var that = this;
this.$element('btnid').getBoundingClientRect({
//填写组件id
success: function (data) {
that.rect = data;
console.log('getBoundingClientRect succeeded, result data =' + JSON.stringify(data));
},
fail() {
console.log('getBoundingClientRect failed');
},
complete: function () {
console.log('getBoundingClientRect completed');
}
});
} 获取的返回值如下:
|