在点击按钮触发一个 for 循环事件
that.progress = xxx
that.progress = Math.ceil((i / fileNumber) * 100)
dom 中没有刷新状态,
console.log(that.progerss)
是正常的
因为这不是对象也不是数组的,不知道为啥会这样
let that = this
let filePath = that.filePath
let fileNumber = that.filesNumber
let files = that.files
let i = 0
async.whilst(() => {
return i < fileNumber
},
(callback) => {
let newPath = path.normalize(files[i]).replace(path.normalize(filePath), path.normalize("C:\\Users\\xxx\\xxx"))
fs.copySync(files[i], newPath)
i++
that.progress = Math.ceil((i / fileNumber) * 100)
console.log(that.progress)
callback()
},()=> {
alert('ok')
})