weex icon indicating copy to clipboard operation
weex copied to clipboard

文档 Demo 不正确

Open AndyFightting opened this issue 9 years ago • 4 comments

在 找节点 --> 获取子组件 这个demo 中,根节点应该是 scroller 吧?

<template>
  <div>
    <text id="goto-top">Top</text>
    <div style="height: 10000; background-color: #999999;"></div>
    <text onclick="back2Top">Back to Top</text>
  </div>
</template>
<script>
  var dom = require('@weex-module/dom')
  module.exports = {
    methods: {
      back2Top: function () {
        var el = this.$el('goto-top')
        dom.scrollToElement(el, { offset: 10 })
      }
    }
  }
</script>

AndyFightting avatar Dec 23 '16 08:12 AndyFightting

没有错啊!

您可以在父组件上下文中使用 this.$el(id) 来找到该组件,以运用 scrollToElement() 为例

找节点使用this.$el(id)与根节点是什么没有关系!

jesusLove avatar Dec 23 '16 08:12 jesusLove

找节点是没错,我是说根节点用div的话就没法滚动到底部去点击了。

AndyFightting avatar Dec 23 '16 08:12 AndyFightting

@DoranYun 留意一下 辛苦了

Jinjiang avatar Dec 23 '16 12:12 Jinjiang

#1966 fixed

Jinjiang avatar Dec 23 '16 23:12 Jinjiang