浏览代码

:recycle: accouting for youtube.com/watch? links

undefined
J 5 年前
父节点
当前提交
a53c63743e
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6
    2
      vue-theme/src/components/content-block/block.vue

+ 6
- 2
vue-theme/src/components/content-block/block.vue 查看文件

@@ -30,8 +30,12 @@ export default {
30 30
     },
31 31
     methods: {
32 32
         fixYoutubeUrl(url) {
33
-            const videoUid = url.split('https://youtu.be/').filter(pieces => pieces.length > 0)[0]
34
-
33
+            let videoUid = url.split('https://youtu.be/').filter(pieces => pieces.length > 0)[0]
34
+            
35
+            if(!videoUid) {
36
+                videoUid = url.split('https://www.youtube.com/watch?v=').filter(pieces => pieces.length > 0)[0]
37
+            }
38
+            
35 39
             return `https://www.youtube.com/embed/${videoUid}`
36 40
         }
37 41
     },

正在加载...
取消
保存