uniapp+firstUI——上传视频组件fui-upload-video

html 复制代码
<fui-upload-video immediate :url="uploadUrl" ref="videoRef" @success="successVideo" @error="errorVideo"
					@complete="completeVideo" width="410" height="250" :header="header"></fui-upload-video>
html 复制代码
<script setup>
	import {
		ref,
		reactive,
		shallowRef
	} from 'vue'
	import {
		onLoad,
		onShow,
		onReachBottom
	} from '@dcloudio/uni-app'
	import i from '@/libs/common/index.js'
	import api from '@/request/api.js'
	import throttle from '@/libs/function/throttle.js'
	import config from '@/libs/config/index.js'
	import {
		userStore
	} from '@/store/userStore.js'
	import {
		commonStore
	} from '@/store/commonStore.js'
	const user = userStore()
	const common = commonStore()
	const fault_video = ref([]) //视频
	const uploadUrl = config.apiUrl + '/api/common/upload'
	const videoRef = shallowRef() //视频组件名称
	const status = ref('') //视频上传状态
	const header = ref({
		'token': uni.getStorageSync('userStorage').token
	})
	const video_url = ref([]) //视频预览列表
	// 视频上传
	function successVideo(e) {
		let res = JSON.parse(e.res.data.replace(/\ufeff/g, "") || "{}")
		status.status = e.status
		if (res.data.url) {
			videoRef.value.result(res.data.url, e.index)
		}
	}
	//上传失败时触发
	function errorVideo(e) {
		status.status = e.status
	}
	//选择视频或上传完成时触发
	function completeVideo(e) {
		status.status = e.status
		video_url.value = e.urls
		if (status.status === 'success' && e.action === 'upload') {
			i.success('上传完成!')
			//已上传完成的视频列表 this.urls
			console.log(video_url.value)
		}
	}
</script>
相关推荐
崔庆才丨静觅6 小时前
hCaptcha 验证码图像识别 API 对接教程
前端
passerby60617 小时前
完成前端时间处理的另一块版图
前端·github·web components
掘了7 小时前
「2025 年终总结」在所有失去的人中,我最怀念我自己
前端·后端·年终总结
崔庆才丨静觅7 小时前
实用免费的 Short URL 短链接 API 对接说明
前端
崔庆才丨静觅8 小时前
5分钟快速搭建 AI 平台并用它赚钱!
前端
崔庆才丨静觅8 小时前
比官方便宜一半以上!Midjourney API 申请及使用
前端
Moment8 小时前
富文本编辑器在 AI 时代为什么这么受欢迎
前端·javascript·后端
崔庆才丨静觅8 小时前
刷屏全网的“nano-banana”API接入指南!0.1元/张量产高清创意图,开发者必藏
前端
剪刀石头布啊8 小时前
jwt介绍
前端
爱敲代码的小鱼9 小时前
AJAX(异步交互的技术来实现从服务端中获取数据):
前端·javascript·ajax