feat: 新增多个组件并优化优惠券相关功能
- 新增 AppLinkSelectDialog 组件,用于选择 APP 链接- 新增 NavigationBarCellProperty组件,用于导航栏单元格属性设置 - 新增 CombinationShowcase 和 CombinationTableSelect 组件,用于拼团活动展示和选择- 优化优惠券相关组件,导出所有优惠券相关组件 - 新增 ComponentContainer 组件,用于包裹和样式化 DIY 组件
This commit is contained in:
@@ -42,3 +42,14 @@ export function isDate(value: any): value is Date {
|
||||
export function isDayjsObject(value: any): value is dayjs.Dayjs {
|
||||
return dayjs.isDayjs(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* element plus 的时间 Formatter 实现,使用 YYYY-MM-DD HH:mm:ss 格式
|
||||
*
|
||||
* @param _row
|
||||
* @param _column
|
||||
* @param cellValue 字段值
|
||||
*/
|
||||
export function dateFormatter(_row: any, _column: any, cellValue: any): string {
|
||||
return cellValue ? formatDate(cellValue)?.toString() || '' : '';
|
||||
}
|
||||
|
||||
@@ -75,6 +75,11 @@ export function fenToYuan(price: number | string): string {
|
||||
return formatToFraction(price);
|
||||
}
|
||||
|
||||
// 格式化金额【分转元】
|
||||
export const fenToYuanFormat = (_: any, __: any, cellValue: any, ___: any) => {
|
||||
return `¥${floatToFixed2(cellValue)}`;
|
||||
};
|
||||
|
||||
/**
|
||||
* 计算环比
|
||||
*
|
||||
|
||||
@@ -44,11 +44,27 @@ export function getNestedValue<T>(obj: T, path: string): any {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 URL 参数值
|
||||
* @param key - 参数键
|
||||
* @returns 参数值,或者未找到时返回空字符串
|
||||
* 获取链接的参数值(值类型)
|
||||
* @param key 参数键名
|
||||
* @param urlStr 链接地址,默认为当前浏览器的地址
|
||||
*/
|
||||
export function getUrlValue(key: string): string {
|
||||
const url = new URL(decodeURIComponent(location.href));
|
||||
export const getUrlNumberValue = (
|
||||
key: string,
|
||||
urlStr: string = location.href,
|
||||
): number => {
|
||||
return Number(getUrlValue(key, urlStr));
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取链接的参数值
|
||||
* @param key 参数键名
|
||||
* @param urlStr 链接地址,默认为当前浏览器的地址
|
||||
*/
|
||||
export const getUrlValue = (
|
||||
key: string,
|
||||
urlStr: string = location.href,
|
||||
): string => {
|
||||
if (!urlStr || !key) return '';
|
||||
const url = new URL(decodeURIComponent(urlStr));
|
||||
return url.searchParams.get(key) ?? '';
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user