将v-for当前项信息从列表带到详情

<WaterfallItem v-for="(item, index) in caseList" :key="index" :order="index">

  <div v-if="item.num>item.sell_num" class="itemImg" :id="item.id" :data="host+item.img_url"  @click="clickImg(item)">
    <div class="img_show"><img :src="host+item.img_url"></div>
    <div class="goodsTit">{{item.title}}:</div> <div class="goodsIntro" v-html="item.remark"></div>
    <p class="inPrice"><i>¥ {{item.price}}</i> <span class="fr">价格:{{item.in_price}}</span></p>
    <p class="numPage">总:{{item.num}} <span class="fr">已卖:{{item.sell_num}}</span></p>
    <!-- <div class="share">
        <span><a href="javascript:void(0);"><img src="../../../static/images/qzone.png"></a></span>
        <span><a href="https://weibo.com/u/3818321066/home?wvr=5"><img src="../../../static/images/weibo.png"></a></span>
        <span><a href="javascript:void(0);"><img src="../../../static/images/weixin.png"></a></span>
    </div> -->
  </div>
</WaterfallItem>
clickImg(item){//点击跳转
  //存储当前点击元素绑定的数据(这里需要将数据转化为字符串,因localStorage只能存字符串),在跳转后的页面将其转为JSON格式
  localStorage.setItem('goodsItem',JSON.stringify(item));
  localStorage.setItem('host',this.host);
  this.$router.push("/oneBuyList");
}

详情页中

created(){
  this.goods=JSON.parse(localStorage.getItem("goodsItem"))
},
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值