看到這個(gè)評(píng)論報(bào)錯(cuò),我也遇到了,是自己寫的不對(duì)
Cannot read property 'reply' of null
要對(duì)模型的 _id 有概念 回復(fù)時(shí) cid = commentID 這里commentID不是指回復(fù)人的id,而是這條評(píng)論數(shù)據(jù)本身的_id,查詢的id沒傳對(duì),查不到數(shù)據(jù),自然就讀不到reply了
正確:data-cid="#{item._id}"
錯(cuò)誤:data-cid="#{user._id}"
可參考我的項(xiàng)目:https://github.com/lancelot-song/Website-backstage-nodejs
求star ~~
Cannot read property 'reply' of null
要對(duì)模型的 _id 有概念 回復(fù)時(shí) cid = commentID 這里commentID不是指回復(fù)人的id,而是這條評(píng)論數(shù)據(jù)本身的_id,查詢的id沒傳對(duì),查不到數(shù)據(jù),自然就讀不到reply了
正確:data-cid="#{item._id}"
錯(cuò)誤:data-cid="#{user._id}"
可參考我的項(xiàng)目:https://github.com/lancelot-song/Website-backstage-nodejs
求star ~~
2017-12-01
記得在發(fā)表評(píng)論的區(qū)域增加一個(gè)用戶登錄的判斷,否則不登錄會(huì)出現(xiàn)錯(cuò)誤
另外我將username存在form標(biāo)簽中,這樣ajax發(fā)布請(qǐng)求就不用讀數(shù)據(jù)庫的用戶名了,減少一些邏輯
if user
form(method="post", action="/movie/comment", id="commentForm", data-username="#{user.name}")
...
else
hr
h5 發(fā)表評(píng)論,請(qǐng)先登錄
另外我將username存在form標(biāo)簽中,這樣ajax發(fā)布請(qǐng)求就不用讀數(shù)據(jù)庫的用戶名了,減少一些邏輯
if user
form(method="post", action="/movie/comment", id="commentForm", data-username="#{user.name}")
...
else
hr
h5 發(fā)表評(píng)論,請(qǐng)先登錄
2017-11-30
https://github.com/savoygu/movie-koa2 基于 koa2 做了上層邏輯重寫,歡迎star
2017-11-28
https://github.com/savoygu/movie-koa2 基于 koa2 做了上層邏輯重寫,歡迎star
2017-11-28
https://github.com/savoygu/movie 基于express4做了一些改進(jìn),歡迎star
2017-11-24
https://github.com/savoygu/movie 基于express4做了一些改進(jìn),歡迎star
2017-11-24
https://github.com/savoygu/movie 基于express4做了一些改進(jìn),歡迎star
2017-11-24