SelectorQuery.exec

解释: 执行所有的请求,请求结果按请求次序构成数组,在 callback 的第一个参数中返回。

方法参数

Function callback

示例

在开发者工具中预览效果

扫码体验

请使用百度APP扫码

图片示例

代码示例

  1. <view class="wrap"> <view class="card-area"> <movable-area> <movable-view class="target" x="{{x}}" y="{{y}}" direction="all" bindchange="queryNodeInfo"> Drag </movable-view> </movable-area> </view> <button type="primary" bindtap="queryNodeInfo">获取Drag的exec的返回值</button></view>
  1. Page({ queryNodeInfo: function(){ swan.createSelectorQuery().select('.target').boundingClientRect().exec(function(rect){ console.log(rect); swan.showModal({ title: 'SelectorQuery.exec的返回值', content: JSON.stringify(rect) }); }) }});
  1. movable-view { display: flex; align-items: center; justify-content: center; height: 100rpx; width: 100rpx; background: #38f; color: #fff; }movable-area { height: 400rpx; width: 400rpx; background-color: #ccc; overflow: hidden;}