评论商品接口有问题

This commit is contained in:
bobobobo
2026-01-16 00:12:33 +08:00
parent d2ba0df2b5
commit 5cd2732562
164 changed files with 14318 additions and 197 deletions

View File

@@ -0,0 +1,50 @@
// @ts-nocheck
// #ifndef UNI-APP-X
type UTSJSONObject = Record<string, any>
// #endif
/**
* 将 CSS 字符串转换为样式对象
* @param css CSS 字符串,例如 "color: red; font-size: 16px;"
* @returns CSSProperties 对象
*/
export function cssToObj(css : string | UTSJSONObject | null) : UTSJSONObject {
// #ifdef APP-ANDROID
if(css == null) return {}
// #endif
// #ifndef APP-ANDROID
if(!css) return {}
// #endif
if(typeof css == 'object') return css as UTSJSONObject
const style : UTSJSONObject = {};
(css as string).split(';').forEach(decl => {
// #ifdef APP-ANDROID
const res = decl.split(':').map(s => s.trim());
if(res.length > 1) {
const [prop, val] = res;
if (prop != '' && val != '') {
const camelProp = prop!.replace(/-([a-z])/g, (_a: string|null, b: string, _c: number, _d: string):string => {
return b.toUpperCase()
});
style[camelProp] = val!;
}
}
// #endif
// #ifndef APP-ANDROID
const [prop, val] = decl.split(':').map(s => s.trim());
if (prop && val) {
const camelProp = prop.replace(/-([a-z])/g, (_, c) => {
return c.toUpperCase()
});
style[camelProp] = val;
}
// #endif
});
return style;
}