1. Write the background management interface

admin->views->CategriesList.vue

 // Click the delete button
        deleteSub(row) {
            this.$confirm('This action will delete the classification${row.cateName}, continue? `.'tip', {
                confirmButtonText: 'sure'.cancelButtonText: 'cancel'.type: 'warning'
            }).then(async() = > {// Send a delete request
                const res =  await this.$_http.delete(`catergories/${row._id}`)
                this.fecth()
                this.$message({
                    type: 'success'.message: 'Deleted successfully! '
                });
                console.log(res); })}Copy the code

2. Write a server interface

serve->router->admin->index.js

 // Delete a classification interface
    router.delete('/catergories/:id'.async (req, res) => {
        const model = await Category.findByIdAndDelete(req.params.id)
        // Send the model to the client to let the client know what is passed into the database
        res.send({
            success: true})})Copy the code