# Conflicts:
#	src/views/mall/statistics/member/index.vue
This commit is contained in:
YunaiV
2023-10-17 19:02:37 +08:00
27 changed files with 856 additions and 98 deletions

View File

@ -205,6 +205,9 @@ export const floatToFixed2 = (num: number | string | undefined): string => {
case 1:
str = f.toString() + '0'
break
case 2:
str = f.toString()
break
}
return str
}

View File

@ -19,6 +19,9 @@ export const isObject = (val: any): val is Record<any, any> => {
}
export const isEmpty = <T = unknown>(val: T): val is T => {
if (val === null) {
return true
}
if (isArray(val) || isString(val)) {
return val.length === 0
}
@ -103,3 +106,12 @@ export const isUrl = (path: string): boolean => {
export const isDark = (): boolean => {
return window.matchMedia('(prefers-color-scheme: dark)').matches
}
// 是否是图片链接
export const isImgPath = (path: string): boolean => {
return /(https?:\/\/|data:image\/).*?\.(png|jpg|jpeg|gif|svg|webp|ico)/gi.test(path)
}
export const isEmptyVal = (val: any): boolean => {
return val === '' || val === null || val === undefined
}

View File

@ -1,12 +1,10 @@
import { createTypes, VueTypesInterface, VueTypeValidableDef } from 'vue-types'
import { VueTypeValidableDef, VueTypesInterface, createTypes, toValidableType } from 'vue-types'
import { CSSProperties } from 'vue'
// 自定义扩展vue-types
type PropTypes = VueTypesInterface & {
readonly style: VueTypeValidableDef<CSSProperties>
}
const propTypes = createTypes({
const newPropTypes = createTypes({
func: undefined,
bool: undefined,
string: undefined,
@ -15,14 +13,12 @@ const propTypes = createTypes({
integer: undefined
}) as PropTypes
// 需要自定义扩展的类型
// see: https://dwightjack.github.io/vue-types/advanced/extending-vue-types.html#the-extend-method
// propTypes.extend([
// {
// name: 'style',
// getter: true,
// type: [String, Object],
// default: undefined
// }
// ])
class propTypes extends newPropTypes {
static get style() {
return toValidableType('style', {
type: [String, Object]
})
}
}
export { propTypes }

View File

@ -93,7 +93,10 @@ export const generateRoute = (routes: AppCustomRouteRecordRaw[]): AppRouteRecord
meta.alwaysShow = true
const childrenData: AppRouteRecordRaw = {
path: '',
name: toCamelCase(route.path, true),
name:
route.componentName && route.componentName.length > 0
? route.componentName
: toCamelCase(route.path, true),
redirect: route.redirect,
meta: meta
}