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>
相关推荐
哆啦A梦15881 天前
商城后台管理系统 06 Mock.js模拟数据
开发语言·javascript·ecmascript
twl1 天前
注意力机制在Code Agent的应用
前端
涔溪1 天前
如何使用 CSS Grid 实现响应式布局?
前端·css
黛色正浓1 天前
leetCode-热题100-哈希合集(JavaScript)
javascript·leetcode·哈希算法
未来读啥科教资讯1 天前
2026年深圳国际户外用品展览会参展效果如何?影响力如何?
前端
码农胖大海1 天前
浏览器及标签页关闭时登出的解决方案
前端·浏览器
喵爸的小作坊1 天前
StreamPanel:一个让 SSE 调试不再痛苦的 Chrome 插件
前端·后端·http
代码续发1 天前
自定义指令
javascript·vue.js·ecmascript
star learning white1 天前
xm C语言12
服务器·c语言·前端
tabzzz1 天前
大道至简:万字漫谈前端性能监控
前端·javascript·性能优化