mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
✨ 视频支持封面下载
This commit is contained in:
@@ -18,6 +18,10 @@ import Artplayer from "artplayer";
|
||||
import type { Option } from "artplayer/types/option.js";
|
||||
import { onMounted, ref, toRaw } from "vue";
|
||||
|
||||
import { getImageBuffer, saveCanvasImg } from "../../utils/TGShare.js";
|
||||
import { bytesToSize } from "../../utils/toolFunc.js";
|
||||
import showSnackbar from "../func/snackbar.js";
|
||||
|
||||
interface TpVod {
|
||||
insert: {
|
||||
vod: {
|
||||
@@ -97,6 +101,19 @@ onMounted(async () => {
|
||||
}</span>`,
|
||||
tooltip: `播放数:${props.data.insert.vod?.view_num ?? 0}`,
|
||||
},
|
||||
{
|
||||
name: "download-cover",
|
||||
index: 0,
|
||||
position: "right",
|
||||
html: `<i class="mdi mdi-download"></i>`,
|
||||
tooltip: "下载封面",
|
||||
click: async () => {
|
||||
const buffer = await getImageBuffer(props.data.insert.vod.cover);
|
||||
const size = bytesToSize(buffer.byteLength);
|
||||
await saveCanvasImg(buffer, `vod-cover-${props.data.insert.vod.id}`);
|
||||
showSnackbar({ text: `封面已下载到本地,大小:${size}` });
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
container.value = new Artplayer(option);
|
||||
|
||||
Reference in New Issue
Block a user