File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 3838 "mermaid" : " ^10.9.0" ,
3939 "mitt" : " ^3.0.0" ,
4040 "moment" : " ^2.30.1" ,
41+ "nanoid" : " ^5.1.5" ,
4142 "npm" : " ^10.2.4" ,
4243 "nprogress" : " ^0.2.0" ,
4344 "pinia" : " ^2.1.6" ,
Original file line number Diff line number Diff line change 11import { MsgError } from '@/utils/message'
2-
2+ import { nanoid } from 'nanoid'
33export function toThousands ( num : any ) {
44 return num ?. toString ( ) . replace ( / \d + / , function ( n : any ) {
55 return n . replace ( / ( \d ) (? = (?: \d { 3 } ) + $ ) / g, '$1,' )
@@ -25,7 +25,7 @@ export function filesize(size: number) {
2525 随机id
2626*/
2727export const randomId = function ( ) {
28- return Math . floor ( Math . random ( ) * 10000 ) + ''
28+ return nanoid ( )
2929}
3030
3131/*
@@ -48,7 +48,9 @@ const typeList: any = {
4848export function getImgUrl ( name : string ) {
4949 const list = Object . values ( typeList ) . flat ( )
5050
51- const type = list . includes ( fileType ( name ) . toLowerCase ( ) ) ? fileType ( name ) . toLowerCase ( ) : 'unknown'
51+ const type = list . includes ( fileType ( name ) . toLowerCase ( ) )
52+ ? fileType ( name ) . toLowerCase ( )
53+ : 'unknown'
5254 return new URL ( `../assets/fileType/${ type } -icon.svg` , import . meta. url ) . href
5355}
5456// 是否是白名单后缀
You can’t perform that action at this time.
0 commit comments