I haven’t used it for a long time. Let’s sort it out today
Batch deletion can be done through a list passed from the front desk.
We use __in to determine whether the elements in the list are in this model
Backend code
class DelAPIView(APIView): def post(self, request): del_list = request.data.get(\'del_list\') # Get the list passed from the front desk BooksModel.objects.filter(id__in = del_list).delete() #Use id__in to get the data and then delete it return Response({\'code\':200,\'msg\':\'okokokok\'})
Front-end code
<tr v-for="book in book_list" > <td><input type="checkbox" :value="book.id" v-model="del_" >< /td> //This is a multi-select box v-model bound to a list :value is bound to the id of each piece of data <td>{{book.title}}</td> <td><img :src="_self.$ host + \'/\' +book.image" alt="This is a picture" width=" 50px" height="50px"></td> tr>
To be continued. . . . .