Browse Source

Merge pull request 'refactor: ♻️ 删除无用代码' (#93) from dev into master

Reviewed-on: common/base_daoshi_vue_ts#93
master
姜鑫 3 years ago
parent
commit
b693a1a70f
  1. 11
      src/utils/utils.ts

11
src/utils/utils.ts

@ -1,3 +1,5 @@
import { PREFIX } from '@/enums'
/**
*
* @param {number} max
@ -117,15 +119,8 @@ export const formatDay = (date: Date, format: 'y.m.d' | 'y/m/d' | 'y-m-d' = 'y-m
return `${year}-${month}-${week}`
}
//判断当前系统
export const isAndroid = () => {
const userAgent = navigator.userAgent
const agents = ['Android', 'iPhone', 'iPad'] as const
return agents.some(item => userAgent.includes(item))
}
//指定key的图片类型加上前缀
export const addPrefixByRecursive = (data: any[], prefix = '/static/offline', exp = /\.(png|jpg|jpeg|JPG|PNG|MP4|mp4)$/) => {
export const addPrefixByRecursive = (data: any[], prefix = PREFIX.STATIC_URL, exp = /\.(png|jpg|jpeg|JPG|PNG|MP4|mp4)$/) => {
if (data && typeof data === 'object') {
for (const key in data) {
if (typeof data[key] === 'string' && exp.test(data[key])) {

Loading…
Cancel
Save