当我在 EJS 中使用 if 它隐藏我的按钮时,我不确定我错过了什么。
我的 todo.ejs
<% if(details.done==0)
{ %><style=" background-color: #accec6 ; text-decoration: line-through;"></style>
<% } %>
<% if(details.done==1) { %>
<a href="/done/<%= details._id %>" type="button" class="succes" >
<p>done</p>
</a>
<% } %>
我的 index.js
app.get("/done/:id",async (req,res) => {
const id = req.params.id;
const tasks = await TodoTask.find({})
console.log('test')
TodoTask.findOneAndUpdate(id,{done: "1"})
});
之前
之后