소스 검색

feat: link icon

chenlei 10 달 전
부모
커밋
8cb88142f9
1개의 변경된 파일10개의 추가작업 그리고 1개의 파일을 삭제
  1. 10 1
      src/views/Home.vue

+ 10 - 1
src/views/Home.vue

@@ -339,7 +339,16 @@ export default {
         window.TagView = TagView;
         // 监听手动点击事件
         TagView.on("click", (e) => {
-          this.openHotFu(e.data);
+          const isLink = e.data.title.startsWith('(link)')
+
+          if (isLink) {
+            const regex = new RegExp(`<\/?p[^>]*>`, 'g')
+            const link = e.data.content.replace(regex, '')
+            const isHttp = link.startsWith('http')
+            window.location.href = isHttp ? link : `https://scene.4dage.com${link}`
+          } else {
+            this.openHotFu(e.data);
+          }
         });
       });