EJS-if 语句

当我在 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"}) 

});

之前

EJS-if 语句

之后

EJS-if 语句

zlzlyw 回答:EJS-if 语句

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/15862.html

大家都在问