0
点赞
收藏
分享

微信扫一扫

ArcGIS Pro SDK (九)几何 3 点

耶也夜 2024-07-24 阅读 9
前端uniapp
// templete
<uni-file-picker v-model="fileList" :limit="1" file-mediatype="image" :sourceType="['album', 'camera']" :image-styles="imageStyle" @select="uploadFile" ></uni-file-picker>
export default {
	data() {
		fileList: [],
		imageStyle: {
			"height": 120,	// 边框高度
			"width": 120,	// 边框宽度
			"border":{ // 如果为 Boolean 值,可以控制边框显示与否
				"color":"#eee",		// 边框颜色
				"width":"1px",		// 边框宽度
				"style":"solid" 	// 边框样式
			}
		}
	},
	methods: {
		uploadFile(e){
			this.fileList.push(e.tempFiles[0])
			uni.uploadFile({
			 	url: '/addFile', // 替换为你的上传API地址
		 	   filePath: e.tempFilePaths[0], // 附件路径
			   name: 'file',
			   formData: {}, // 可加入表单内其他参数
			   success: (res) => { //成功回调
			    const result = JSON.parse(res.data) // 成功回调返回结果
			   },
			   fail: (error) => { //失败回调
			   	console.log(error)
			   }		
			})
		}
	}
}

在这里插入图片描述

举报

相关推荐

0 条评论