The WeChat applet scroll-view scrolls horizontally to the specified position

During the development process, tabs are used to represent list pages in different states. The requirement is to switch from different entrances to a desired tab page. At this time, the scroll-into-view attribute in scroll-view is used.

In fact, summing up the specific requirements is to use scroll-view to scroll horizontally to a specified position.

Use the scroll-view label to set the scrolling direction as the x-axis, and at the same time set the value of the scroll-into-view attribute (the value of scroll-into-view is the id in the child element, indicating which element to scroll to)

Create a new sub-element of view for scroll-view, then set the id, and create a few more sub-elements.

Specifically, which specific sub-element needs to be jumped to, just correspond to the id value and the value of scroll-into-view.

scroll-into-view:

scroll-into-view string   no The value should be a child element id (id cannot start with a number). Set which direction is scrollable, in which direction to scroll to the element

The vertical scrolling method is similar, just set the scrolling direction to the y-axis.

Guess you like

Origin blog.csdn.net/jianshou6442/article/details/113587961
Recommended