1. Custom attribute/get attribute value
Custom properties:
<view bindtap='shopPost' data-myid='item.goods_id' ></view>
Get properties:
shopPost:function(e){ //var postId = e.Target.dataset.myid; var postId = e.currentTarget.dataset.myid }
2. Passing/Getting Parameters
Get parameters and pass parameters
onPostTap:function(e) { // Get custom myid let postId= e.currentTarget.dataset.myid; wx.navigateto({ url:'detail?id='+postId }) }
The detail page receives parameter values:
onLoad:function(options) { let postId=options.id; }
3, Image image achieves 100% width and height adaptive
Set the bandwidth to 100% and add the attribute mode="widthFix", such as:
<image style="width: 100%;" src="../../images/hello.png" mode="widthFix">
Reference document:
https://www.w3cschool.cn/weixinapp/1k7h1ug9.html