Refs

提供了 wx:ref="xxx" 来更方便获取 WXML 节点信息的对象。在JS里只需要通过this.$refs.xxx 即可获取节点。

示例:

  1. <template>
  2. <view wx:ref="tref">
  3. 123
  4. </view>
  5. </template>
  6. <script>
  7. import {createComponent} from '@mpxjs/core'
  8. createComponent({
  9. ready () {
  10. this.$refs.tref.fields({size: true}, function (res) {
  11. console.log(res)
  12. }).exec()
  13. }
  14. })
  15. </script>