page的css属性支持解析动画和audio组件展示NAN的buf_fix

This commit is contained in:
v_xukeke 2023-02-23 17:31:14 +08:00
parent 066f75bfa6
commit d7c78aeeb8
2 changed files with 13 additions and 11 deletions

View File

@ -299,8 +299,8 @@ export class Audio extends React.Component<AudioProps, AudioState> {
formatTime(seconds: number) {
const date = new Date(seconds * 1000);
const hh = date.getUTCHours();
const mm = date.getUTCMinutes();
const ss = this.pad(date.getUTCSeconds());
const mm = isNaN(date.getUTCMinutes()) ? 0 : date.getUTCMinutes();
const ss = isNaN(date.getUTCSeconds()) ? '00': this.pad(date.getUTCSeconds());
if (hh) {
return `${hh}:${this.pad(mm)}:${ss}`;
}

View File

@ -41,18 +41,11 @@ import {buildStyle} from 'amis-core';
import {PullRefresh} from 'amis-ui';
import {scrollPosition, isMobile} from 'amis-core';
/**
*
*/
interface Declaration {
[property: string]: string;
}
/**
* css
*/
interface CSSRule {
[selector: string]: Declaration; // 定义
[selector: string]: Record<string, string> | Record<string, Record<string, string>>; // 定义
}
/**
@ -333,7 +326,16 @@ export default class Page extends React.Component<PageProps> {
const declaration = cssRules[selector];
let declarationStr = '';
for (const property in declaration) {
declarationStr += ` ${property}: ${declaration[property]};\n`;
let innerstr = ''
const innerValue=declaration[property]
if (typeof innerValue==='string') {
declarationStr += ` ${property}: ${innerValue};\n`;
} else {
for (const propsName in innerValue) {
innerstr+= ` ${propsName}:${innerValue[propsName]};`;
}
declarationStr += ` ${property} {${innerstr}}\n`;
}
}
css += `