wx.uploadfile 上传成功后页面会刷新
发布于 5 年前 作者 ugao 782 次浏览 来自 问答
wx.uploadFile({
             url: api + 'files/upload',
             filePath: res.tempFilePaths[i],
             name: 'file',
             header: {
               "content-type": "multipart/form-data",
               "x-auth-token": that.data.token
             },
             success: function(res) {
               let data = JSON.parse(res.data);
               that.data.uploadFileList.push(data.path)
               wx.hideLoading();
             },
             fail: function(res) {
               wx.hideLoading();
               wx.showToast({
                 title: '上传失败!',
                 icon: 'none',
                 duration: 1000
               })
             }
           })

因为这个图片上传之后会刷新页面,导致我页面上面的数据都被初始化了,这个问题请问下大家该如何解决?

1 回复

避免使用onshow,尽量使用onload可以解决这个问题

回到顶部