-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(form): default close swr cache (#4470)
* fix(form): use new uuid function * fix(form): default close swr cache * fix test * fix test * fix test * fix test
- Loading branch information
1 parent
a9394e2
commit 770a0fb
Showing
9 changed files
with
46 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,6 +127,7 @@ export default () => { | |
]} | ||
readonly | ||
width="xs" | ||
cacheForSwr | ||
name="useMode" | ||
label="合同约定生效方式" | ||
/> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* eslint-disable prefer-const */ | ||
let genNanoid = (t = 21) => { | ||
let e = '', | ||
r = crypto.getRandomValues(new Uint8Array(t)); | ||
// eslint-disable-next-line no-param-reassign | ||
for (; t--; ) { | ||
let n = 63 & r[t]; | ||
e += | ||
n < 36 ? n.toString(36) : n < 62 ? (n - 26).toString(36).toUpperCase() : n < 63 ? '_' : '-'; | ||
} | ||
return e; | ||
}; | ||
|
||
/** | ||
* 生成uuid,如果不支持 randomUUID,就用 genNanoid | ||
* | ||
* @returns | ||
*/ | ||
export const nanoid = () => { | ||
if (typeof window === 'undefined') { | ||
return genNanoid(); | ||
} | ||
// @ts-ignore | ||
if (crypto && crypto.randomUUID && typeof crypto.randomUUID == 'function') { | ||
// @ts-ignore | ||
return crypto.randomUUID(); | ||
} | ||
return genNanoid(); | ||
}; |