Skip to content

Commit

Permalink
feat(VideoLink): Remove video domain validation and allow any URL for…
Browse files Browse the repository at this point in the history
… embedding
  • Loading branch information
Theo-Messi committed Sep 1, 2024
1 parent 6e5b9a9 commit fd9dfcc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 29 deletions.
4 changes: 0 additions & 4 deletions docs/guide/video.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ export default {
}
```

::: tip
点击查看[目前支持的链接](https://github.com/Theo-Messi/tools/blob/main/packages/Lumen/components/videoDomains.ts),如有补充欢迎提交!
:::

## 示例

**输入**
Expand Down
15 changes: 3 additions & 12 deletions packages/Lumen/components/DocVideoLink.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
import { videoDomains } from './videoDomains'
/**
* 组件的 props 类型定义。
Expand All @@ -18,14 +17,6 @@ const props = defineProps<{
name: string
}>()
/**
* 计算属性,判断 `href` 是否属于视频域名。
* @type {ComputedRef<boolean>}
*/
const isVideo = computed(() => {
return videoDomains.some((domain) => props.href.startsWith(domain))
})
/**
* 视频播放状态,初始为关闭状态。
* @type {Ref<boolean>}
Expand All @@ -49,19 +40,19 @@ const toggleVideo = () => {
<div class="mp" @click="toggleVideo">
<div class="cta" :title="props.name">
<div class="name-container">
<i v-if="isVideo" class="fas fa-video"></i>
<i v-if="props.href" class="fas fa-video"></i>
<div class="name">{{ props.name }}</div>
</div>
<i
v-if="isVideo"
v-if="props.href"
:class="{
'fas fa-chevron-up': isVideoOpen,
'fas fa-chevron-down': !isVideoOpen
}"
></i>
</div>
<transition name="slide">
<div v-show="isVideo && isVideoOpen" class="video-embed">
<div v-show="props.href && isVideoOpen" class="video-embed">
<div class="iframe-container">
<iframe
loading="lazy"
Expand Down
13 changes: 0 additions & 13 deletions packages/Lumen/components/videoDomains.ts

This file was deleted.

0 comments on commit fd9dfcc

Please sign in to comment.