引入art-template,并获取需要的数据 官网链接 打印
console. log ( template)
console. log ( '获取的数据' )
list为数据中的一个属性 onClick传递参数
< script type = " text/html" id = " starTemplate" >
{ { each starLists as v i} }
< li class = "wow fadeInUp animated" bookId= "{{v.bookmarkId}}" >
< input type= "checkbox" class = "check goods-check goodsCheck" >
< div class = "shop-info-img" > < a href= "#" > < img style= "width:200px; height:267px;" src= "{{v.starCover}}" > < / a> < / div>
< div class = "shop-info-text" >
< div>
< h3> { { v. starName} } < / h3>
< p> { { v. starOccupation} } < / p>
< / div>
< a href= "#javascrip:;" bookmarkid= "{{v.bookmarkId}}" starid= "{{v.starId}}" onclick= "delStar(this, '需要的静态参数')" > < / a>
< / div>
< / li>
{ { / each} }
</ script>
function delStar(e, otherParams) {
let bookmarkId = e.getAttribute ( 'bookmarkid' )
let starId = e.getAttribute ( 'starid' )
console.log ( bookmarkId, starId, otherParams)
}