在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ vue-simple-uploader上傳成功之后的response怎么獲???

vue-simple-uploader上傳成功之后的response怎么獲???

vue-simple-uploader的文檔中沒有找到回調(diào)response,也沒有找到類似的函數(shù)。希望能夠得到指導(dǎo)。

回答
編輯回答
菊外人

<template>
<uploader :options="options" :file-status-text="statusText" class="uploader-example" ref="uploader" @file-success="fileSuccess"></uploader>
</template>
<script>
export default {

data () {
  return {
    options: {
      target: '//localhost:3000/upload', // '//jsonplaceholder.typicode.com/posts/',
      testChunks: false
    },
    attrs: {
      accept: 'image/*'
    },
    statusText: {
      success: '成功了',
      error: '出錯(cuò)了',
      uploading: '上傳中',
      paused: '暫停中',
      waiting: '等待中'
    }
  }
},
methods: {
//上傳成功的事件
fileSuccess (rootFile, file, message, chunk) {
  console.log('complete', rootFile, file, message, chunk)
}
},
mounted () {
// 獲取uploader對(duì)象
  this.$nextTick(() => {
    window.uploader = this.$refs.uploader.uploader
  })
}

}
</script>

2017年7月5日 02:33
編輯回答
脾氣硬

options配置里面
可參照simple-uploader.js

里面有個(gè)屬性:checkChunkUploadedByResponse;

另外 通過ref獲取組件,是否可以過去到uploader的實(shí)例,然后通過他的filesuccess方法;
沒有用過這個(gè)插件,不知道能不能實(shí)現(xiàn)。不過謝謝樓主 讓我知道了這么牛的插件

2017年1月28日 16:52