From 1204fb64695940a4c7be103c8b635f4285721869 Mon Sep 17 00:00:00 2001 From: terwer Date: Tue, 23 Aug 2022 22:41:40 +0800 Subject: [PATCH] fix:Add tag --- jvue-front/pages/post/_id.vue | 36 +++++++++++++++++++ .../terwergreen/jvueserver/util/HtmlUtil.java | 10 +++--- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/jvue-front/pages/post/_id.vue b/jvue-front/pages/post/_id.vue index 4a8db4b..45f5771 100644 --- a/jvue-front/pages/post/_id.vue +++ b/jvue-front/pages/post/_id.vue @@ -43,6 +43,18 @@ +
+ + + +
+
{ + const randomColor = colors[Math.floor(Math.random() * colors.length)]; + + tagArr.push({ + tag: item, + color: randomColor + }); + }); + } + + Object.assign(postObj, { + tagArray: tagArr + }); + logger.info("fetch siteConfig and post finish"); return { siteConfigObj, postObj, errorMessage }; @@ -216,6 +247,11 @@ export default { } } +.post-default .post-tag { + margin-right: 10px; + cursor: pointer; +} + .post-default #postContent { h1 { font-size: 28px; diff --git a/jvue-server/src/main/java/com/terwergreen/jvueserver/util/HtmlUtil.java b/jvue-server/src/main/java/com/terwergreen/jvueserver/util/HtmlUtil.java index 7f39a45..89826cf 100644 --- a/jvue-server/src/main/java/com/terwergreen/jvueserver/util/HtmlUtil.java +++ b/jvue-server/src/main/java/com/terwergreen/jvueserver/util/HtmlUtil.java @@ -14,17 +14,17 @@ private static String parseHtml(String html) { * "<.*?"表示<尖括号后的所有字符,此方法可以去掉残缺的标签,及后面的内容 * " ",若有多种此种字符,可用同一方法去除 */ + html = html.replaceAll("", ""); + html = html.replaceAll("", ""); + html = html.replaceAll("", ""); + html = html.replaceAll("", ""); + html = html.replaceAll("<.*?>", ""); html = html.replaceAll("<.*?", ""); html = html.replaceAll("\\n", ""); html = html.replaceAll(""", ""); html = html.replaceAll(" ", ""); - html = html.replaceAll("", ""); - html = html.replaceAll("", ""); - html = html.replaceAll("", ""); - html = html.replaceAll("", ""); - return (html); }