您当前的位置: 首页 >  ar

彭世瑜

暂无认证

  • 1浏览

    0关注

    2791博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

elementUI:Upload组件list-type: picture-card上传闪动

彭世瑜 发布时间:2020-12-31 17:20:16 ,浏览量:1

直接push file对象 可以解决

多图上传示例


        


props: {
    // 引用传递数组 { name, url }
    files: { type: Array, default: null },
 },
 
methods: {
     // 自定义实现文件上传
     async uploadFile(params) {
      let form = new FormData();
      form.append('image', params.file);
      const res = await this.$Http.commonUpload(form);
      return res;
    },
    
	// 处理添加
	handleSuccess(response, file, fileList) {
	   // 设置url
	   file.url = response.data.url;
	   this.files.push(file);
	},
	
	// 移除
	handleRemove(file, fileList) {
		this.files.splice(0, this.files.length, ...fileList);
	}
} 

参考 饿了么UI组件库中,Upload组件上传闪动的解决

关注
打赏
1665367115
查看更多评论
立即登录/注册

微信扫码登录

0.0566s