wx.pageScrollTo 没效果
发布于 5 年前 作者 wuchao 7950 次浏览 来自 官方Issues

不管放什么参数都没效果 只有个A打印出来 complete什么的都打印不出东西

toLast:function(){

    var that = this

    console.log(‘A’)

    wx.pageScrollTo({

        selector: ‘last’,

    })

}

4 回复

<view class=“last” id=“last”></view>

‘.last’ 或 ‘#last’

还有就是如果该节点元素已经在屏幕可视区域,就不会在有滚动效果

 wx.pageScrollTo({

        selector: 'last',

    })

last 前加 ‘.’或者‘#’

 wx.pageScrollTo({

        selector: '.last',

    })

或者

 wx.pageScrollTo({

        selector: '#last',

    })

现在就是这样  点了后 打印是成功执行 但是没有效果

selector 语法

selector类似于 CSS 的选择器,但仅支持下列语法。

  • ID选择器:#the-id

  • class选择器(可以连续指定多个):.a-class.another-class

  • 子元素选择器:.the-parent > .the-child

  • 后代选择器:.the-ancestor .the-descendant

  • 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant

  • 多选择器的并集:#a-node, .some-other-nodes

回到顶部