vue+elementUi+el-upload实现上传获取本机文件路径获取本机服务器路径电脑盘符createObjectURLgetElementsByClassName

Posted web半晨

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue+elementUi+el-upload实现上传获取本机文件路径获取本机服务器路径电脑盘符createObjectURLgetElementsByClassName相关的知识,希望对你有一定的参考价值。

目录


1、html

<el-upload
	action=""
	:limit="1"
	:on-change="handleChange"
	:auto-upload="false"
	:file-list="fileList"
	:show-file-list="false"
>
	<span>选择文件</span>
</el-upload>

2、javascript

export default 
	data()  
		return ;
	,

	methods: 
		// 选择文件
		handleChange(file, fileLists) 
			console.log(file);
			console.log(fileLists);
			// 本地服务器路径
			console.log(URL.createObjectURL(file.raw));
			// 本地电脑路径
			console.log(document.getElementsByClassName("el-upload__input")[0].value); 
		,
	,
;
创作打卡挑战赛 赢取流量/现金/CSDN周边激励大奖

以上是关于vue+elementUi+el-upload实现上传获取本机文件路径获取本机服务器路径电脑盘符createObjectURLgetElementsByClassName的主要内容,如果未能解决你的问题,请参考以下文章