<template>
<div>
<div v-if="cartlist.length <= 0 ">你没有选择的商品,购物车为空~</div>
<table v-else>
<caption><h1>购物车</h1></caption>
<tr>
<th></th>
<th>编号</th>
<th>商品名称</th>
<th>商品价格</th>
<th>购买数量</th>
<th>操作</th>
</tr>
<tr v-for="(item,index) in cartlist" :key="item.id">
<td><input type="checkbox" v-model="item.checkbox" name="" id=""></td>
<td>{
{item.id}}</td>
<td>{
{item.name}}</td>
<td><small>¥</small>{
{item.price.toFixed(2)}}</td>
<td>
<button @click="
通过Vue3快速实现PC购物车功能
最新推荐文章于 2023-06-29 18:20:26 发布