1.index.html
<td><a href="/doDelete?id={{@$value._id}}" type="button" class="btn btn-success">删除</a>
2.doDelete.js
const Router = require("koa-router");
const router = new Router();
const ShopMangeModel = require("../models/shopMange");
// 查询数据库
router.get("/doDelete",async ctx=>{
console.log(ctx.query)
var {id} = ctx.query;
await ShopMangeModel.deleteOne({_id:id});
ctx.redirect("/")
})
module.exports = router;