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>
相关推荐
林恒smileZAZ3 小时前
Vue<前端页面版本检测>
前端·javascript·vue.js
码事漫谈6 小时前
当AI开始“思考”:我们是否真的准备好了?
前端·后端
许杰小刀7 小时前
ctfshow-web文件包含(web78-web86)
android·前端·android studio
我是Superman丶7 小时前
Element UI 表格某行突出悬浮效果
前端·javascript·vue.js
恋猫de小郭7 小时前
你的代理归我了:AI 大模型恶意中间人攻击,钱包都被转走了
前端·人工智能·ai编程
xiaokuangren_8 小时前
前端css颜色
前端·css
Huanzhi_Lin8 小时前
关于V8/MajorGC/MinorGC——性能优化
javascript·性能优化·ts·js·v8·新生代·老生代
hoiii1878 小时前
C# 基于 LumiSoft 实现 SIP 客户端方案
前端·c#
anOnion8 小时前
构建无障碍组件之Meter Pattern
前端·html·交互设计
小码哥_常9 小时前
Spring Boot配置diff:解锁配置管理新姿势
前端