Use of Mini Program Anchor

<scroll-view scroll-into-view="{
     
     {toView}}" style="height:{
       
       {
       
       pageGaodu.windowHeight}}px" scroll-y="true" scroll-with-animation="true">
	<view bindtap="wxpaley" data-havs="havs">
		点击去目标地方
	</view>
	<view class="shopListTitle" id='havs'>
		我是目标地方
	</view>
</scroll-view>
	data:{
    
    
		pageGaodu:{
    
    },
		toView:'default',
	}
	
	onLoad:function(){
    
    
		let that = this
		 wx.getSystemInfo({
    
    
	      success:function(res){
    
    
	        console.log(res)
	        that.setData({
    
    
	          pageGaodu:res
	        })
	      }
	    })
	}
	wxplay(e){
    
    
	   let havs = e.target.dataset.havs;
	   that.setData({
    
    
	      toView: havs
	    })
	}

Guess you like

Origin blog.csdn.net/hql1024/article/details/106918834