page: 📄 blob相关
This commit is contained in:
parent
9133a8c8e4
commit
022d35b8ea
|
@ -1 +1 @@
|
||||||
{"version":1722474202768}
|
{"version":1722520010238}
|
|
@ -0,0 +1,18 @@
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { onMounted, ref } from 'vue';
|
||||||
|
|
||||||
|
const objectURL = ref();
|
||||||
|
/**
|
||||||
|
* * Blob相关测试
|
||||||
|
*/
|
||||||
|
const blobTest = () => {
|
||||||
|
const blob = new Blob(['这时一段文本内容'], { type: 'text/plain;charset=utf-8' });
|
||||||
|
objectURL.value = URL.createObjectURL(blob);
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => blobTest());
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<textarea :value="objectURL" class="w-[500px] h-[300px]" />
|
||||||
|
</template>
|
|
@ -28,8 +28,9 @@ const onDownloadImage = () => {
|
||||||
* * 下载视频
|
* * 下载视频
|
||||||
*/
|
*/
|
||||||
const onDownloadVideo = () => {
|
const onDownloadVideo = () => {
|
||||||
const imageBlob = fetch(video.value).then(res => res.blob());
|
fetch(video.value)
|
||||||
imageBlob.then(blob => downloadBlob(blob, 'blob视频.mp4'));
|
.then(res => res.blob())
|
||||||
|
.then(blob => downloadBlob(blob, 'blob视频.mp4'));
|
||||||
|
|
||||||
downloadURI(video.value, 'a标签视频.mp4');
|
downloadURI(video.value, 'a标签视频.mp4');
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue