vue-element图片上传

<el-upload
	action=""
	:limit="1"
	:on-change="handleChange"
	:auto-upload="false"
	:file-list="fileList"
	:show-file-list="false"
>
	<span>选择文件</span>
</el-upload>
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); 
		},
	},
};
posted @ 2022-10-17 08:49  SultanST  阅读(14)  评论(0编辑  收藏  举报