Explorar o código

VideoPlayerCard.vue 的 danmaku 添加一个 maximum 字段
SearchVideoCard.vue 中添加一个 stripHtml 处理 hover 卡片时视频标题包含的 html 标签

reghao hai 2 días
pai
achega
fc1ec5d3c6

+ 6 - 1
src/components/card/SearchVideoCard.vue

@@ -1,6 +1,6 @@
 <template>
   <el-col class="video-card-container">
-    <div class="video-card-wrapper" :title="video.title">
+    <div class="video-card-wrapper" :title="stripHtml(video.title)">
       <el-card :body-style="{ padding: '0px' }" class="video-card shadow-hover">
         <router-link target="_blank" :to="`/video/${video.videoId}`" class="cover-link">
           <div class="image-container">
@@ -72,6 +72,11 @@ export default {
     }
   },
   methods: {
+    // 过滤掉所有的 HTML 标签
+    stripHtml(html) {
+      if (!html) return '';
+      return html.replace(/<[^>]+>/g, '');
+    },
     getVisited(visited) {
       return handleVisited(visited)
     }

+ 1 - 1
src/components/card/VideoPlayerCard.vue

@@ -76,7 +76,7 @@ export default {
         screenshot: true,
         volume: 0.1,
         video: { pic: this.videoData.coverUrl, defaultQuality: 0, quality: urls },
-        danmaku: { id: this.videoId, api: this.danmakuApi, token: this.userToken, bottom: '15%', unlimited: true }
+        danmaku: { id: this.videoId, maximum: 10000, api: this.danmakuApi, token: this.userToken, bottom: '15%', unlimited: true }
       })
       this.player.seek(pos)
       this.bindEvents()