Selaa lähdekoodia

feat: link icon

chenlei 10 kuukautta sitten
vanhempi
commit
8cb88142f9
1 muutettua tiedostoa jossa 10 lisäystä ja 1 poistoa
  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);
+          }
         });
       });