The applet obtains the id of all the products in the shopping cart, and the console.log is the solution when it is undefined

First declare an array

let  goodsIdlist=[]

Then we need to traverse the js page through jQuery and add it

 shoplist.map(element=>{
    
    
      goodsIdlist.push(element.goodsId)
    })
    this.setData({
    
    
      goodsIdlist:goodsIdlist
    })

Then split by join

    console.log(goodsIdlist.join(","))

Then you can get the product id of the string

Guess you like

Origin blog.csdn.net/wsxDream/article/details/112270745