export default {
  data() {
    return {
      axiosConfig: {
        onUploadProgress: progressEvent => {
          if (progressEvent.total / 1024 > 100) {
            const text = 'درحال آپلود '
            const uploadLayout = this.$loading({
              lock: true,
              text,
              spinner: 'el-icon-loading',
              background: 'rgba(0, 0, 0, 0.7)'
            })
            document.querySelector('.el-loading-text').innerText =
              text + Math.floor((progressEvent.loaded / progressEvent.total) * 100) + '%'
            if ((progressEvent.loaded / progressEvent.total) * 100 === 100) {
              uploadLayout.close()
            }
          }
        }
      }
    }
  }
}
