Browse Source

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

Reviewed-on: common/base_daoshi_vue_ts#92
test
姜鑫 3 years ago
parent
commit
d6d91f4d67
  1. 11
      src/utils/utils.ts

11
src/utils/utils.ts

@ -1,3 +1,5 @@
import { PREFIX } from '@/enums'
/** /**
* *
* @param {number} max * @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}` 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的图片类型加上前缀 //指定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') { if (data && typeof data === 'object') {
for (const key in data) { for (const key in data) {
if (typeof data[key] === 'string' && exp.test(data[key])) { if (typeof data[key] === 'string' && exp.test(data[key])) {

Loading…
Cancel
Save