If it is on the web side, this is relatively simple, just set the scrolling bottom of that element directly.
But only the page scroll pageScroll in the applet
But we can't do it at this time. It is
recommended to change the long list to a ScrollView scrolling list for operation, and then set it by setting the scrollTop of this list.
I take taro as an example here. In fact, native applet and uniapp are almost the same as this
<ScrollView
className='scrollview'
scrollY
scrollWithAnimation
scrollTop={
scrollTop}
>
<View style={
vStyleA}>A</View>
<View style={
vStyleB}>B</View>
<View style={
vStyleC}>C</View>
</ScrollView>
Some children's shoes may question us, but we don't know what the scrolling height of this long list is. How to set it?
In fact, as long as you set it large enough. He will scroll to the bottom, for
example, I set 9999 here
this.setState({
scrollTop: 9999
})
But don't set it so big as soon as you enter the page. need a timer
setTimeout(() => {
this.setState({
scrollTop: 9999
})
})
It should also be noted that if the same value is set twice, she will not move at the original position. At
this time, we only need to add 1 to the original basis, and she will remain at the bottom.
this.setState({
scrollTop: this.state.scrollTop + 1
})
This can be achieved.
You can also private message me if you have any questions. I will answer you
Follow me to keep updating front-end knowledge