feat: 新的全局组件bili

This commit is contained in:
camera-2018
2023-07-19 02:01:51 +08:00
parent 7800960374
commit 3440b61c63
2 changed files with 27 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ import { h, watch } from 'vue'
// import Theme from 'vitepress/theme' // import Theme from 'vitepress/theme'
import DefaultTheme from 'vitepress/theme-without-fonts' import DefaultTheme from 'vitepress/theme-without-fonts'
import Download from '../../components/Download.vue' import Download from '../../components/Download.vue'
import Bilibili from '../../components/Bilibili.vue'
import './style.css' import './style.css'
import './rainbow.css' import './rainbow.css'
@@ -18,6 +19,7 @@ export default {
enhanceApp(ctx) { enhanceApp(ctx) {
DefaultTheme.enhanceApp(ctx) DefaultTheme.enhanceApp(ctx)
ctx.app.component('Download', Download) ctx.app.component('Download', Download)
ctx.app.component('Bilibili', Bilibili)
if (typeof window === 'undefined') if (typeof window === 'undefined')
return return

25
components/Bilibili.vue Normal file
View File

@@ -0,0 +1,25 @@
<template>
<iframe :src="`//player.bilibili.com/player.html?bvid=${bvid}&autoplay=false`" scrolling="no" border="0" frameborder="no"
framespacing="0" allowfullscreen="true" class="bili_iframe"/>
</template>
<script setup>
import { defineProps } from 'vue'
const { bvid } = defineProps({
bvid: {
type: String,
default: 'BV1GJ411x7h7',
required: true,
validator: (value) => {
return value.trim() !== ''
}
}
})
</script>
<style scoped>
.bili_iframe {
width: 100%;
height: 23rem;
}
</style>