index.html

  1. <a href="/m1/doDelete?id={{@ $value._id}}" type="button" class="btn btn-danger" >删除</a>

m1/doDelete.js

  1. const MembersModel = require("../../models/Members");
  2. const router = require("koa-router")();
  3. router.get("/m1/doDelete",async ctx=>{
  4. var {id} = ctx.query
  5. await MembersModel.deleteOne({_id:id})
  6. ctx.redirect('/m1')
  7. })
  8. module.exports = router;