vue2+TS 实现一个简单的购物车功能,v-model绑定一个数组,选中,绑定的数组checkList并未有数据更新
<template>
<div id="box">
<ul>
<li>
<div>
<input type="checkbox" name="" id="">
<span>全选/全不选</span>
</div>
</li>
<li v-for="item in dataList" :key="item.id">
<div>
<input type="checkbox" v-model="checkList" :value="item">
</div>
<div>
<img :src="item.poster" alt="">
</div>
<div>
<div>{{ item.title }}</div>
<div style="color: red;">价格1: {{ item.price }}</div>
</div>
<div>
<button>-</button>
{{ item.number }}
<button>+</button>
</div>
<div>
<button>删除</button>
</div>
</li>
</ul>
{{ checkList }}
</div>
</template>
<script setup lang="ts">
import getList from '@/api/login.ts';
import { onMounted, reactive} from 'vue'
let dataList:Array<any> = reactive([])
let checkList = reactive([])