@idooel/components 0.0.2-beta.6 → 0.0.2-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -164,8 +164,7 @@ export default {
|
|
|
164
164
|
querys: {
|
|
165
165
|
type: Object,
|
|
166
166
|
default: () => ({
|
|
167
|
-
_csrf: localStorage.getItem('token')
|
|
168
|
-
_t: new Date().valueOf()
|
|
167
|
+
_csrf: localStorage.getItem('token')
|
|
169
168
|
})
|
|
170
169
|
},
|
|
171
170
|
headers: {
|
|
@@ -590,10 +589,27 @@ export default {
|
|
|
590
589
|
this.activateUploadComponent(newFile, oldFile)
|
|
591
590
|
},
|
|
592
591
|
|
|
592
|
+
/**
|
|
593
|
+
* 生成唯一的随机数
|
|
594
|
+
*/
|
|
595
|
+
generateUniqueRandom() {
|
|
596
|
+
// 使用 crypto.getRandomValues 生成更安全的随机数
|
|
597
|
+
if (window.crypto && window.crypto.getRandomValues) {
|
|
598
|
+
const array = new Uint32Array(1)
|
|
599
|
+
window.crypto.getRandomValues(array)
|
|
600
|
+
return array[0].toString()
|
|
601
|
+
}
|
|
602
|
+
// 降级方案:使用 Math.random 结合时间戳
|
|
603
|
+
return Math.random().toString(36).substr(2, 9) + Date.now().toString(36)
|
|
604
|
+
},
|
|
605
|
+
|
|
593
606
|
/**
|
|
594
607
|
* 处理文件添加
|
|
595
608
|
*/
|
|
596
609
|
handleFileAdd(newFile) {
|
|
610
|
+
// 为每个文件生成唯一的随机数
|
|
611
|
+
const uniqueRandom = this.generateUniqueRandom()
|
|
612
|
+
newFile.postAction = newFile.postAction + '&_t=' + uniqueRandom
|
|
597
613
|
console.log('add file:', newFile)
|
|
598
614
|
console.log('extensions:', this.extensions)
|
|
599
615
|
console.log('accept:', this.accept)
|
|
@@ -606,7 +622,6 @@ export default {
|
|
|
606
622
|
this.removeInvalidFile(newFile)
|
|
607
623
|
return
|
|
608
624
|
}
|
|
609
|
-
|
|
610
625
|
console.log('文件类型验证通过,继续上传')
|
|
611
626
|
},
|
|
612
627
|
|
package/scripts/rollup.config.js
CHANGED
|
@@ -14,7 +14,7 @@ import { resolve } from 'path'
|
|
|
14
14
|
/** @type { import('rollup').RollupOptions } */
|
|
15
15
|
export default {
|
|
16
16
|
input: 'packages/index.js',
|
|
17
|
-
external: ['vue', '@idooel/shared', 'vue-upload-component', 'moment'],
|
|
17
|
+
external: ['vue', '@idooel/shared', '@idooel/expression', 'vue-upload-component', 'moment'],
|
|
18
18
|
plugins: [
|
|
19
19
|
nodeResolve(),
|
|
20
20
|
vue({
|