From bd1f753bda524c74e7bc81af0d63d73335a21180 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Sun, 7 Oct 2018 16:45:17 +0800 Subject: [PATCH] feat: bring up parent comment render --- src/disqus.js | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/disqus.js b/src/disqus.js index d69781c..7958646 100644 --- a/src/disqus.js +++ b/src/disqus.js @@ -482,21 +482,14 @@ function getCommentList(data) { } function renderComment(data) { - var commentContainerTpl = ` -
- -
- `; - - var commentItemTpl = ` - - ` - - var commentItem; - data.map(function (comment) { - console.log(comment) + var disqusjsBaseTpl = '
    '; + document.getElementById('disqus_thread').innerHTML = disqusjsBaseTpl; + + var commentItemTpl = '
  • <% if (comment.author.profileUrl) { %><% } %><% if (comment.author.profileUrl) { %><% } %>
    <% if (comment.author.profileUrl) { %><% } %><%= comment.author.name %><% if (comment.author.profileUrl) { %><% } %>
    <%- comment.message %>
  • '; + + data.map(function (s) { + var html = baidu.template(commentItemTpl, s); + document.getElementById('dsqjs-list').insertAdjacentHTML('beforeend', html); }) }