mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-03 04:18:29 +08:00
fix:日志组件在没配置 source 的时候不发起请求 (#1548)
This commit is contained in:
parent
d7fae41a81
commit
939c85f61c
@ -100,6 +100,7 @@ register('en-US', {
|
||||
'Image.sizeNotEqual': 'The image you selected does not meet the size requirements {{info}}',
|
||||
'Image.width': 'width: {{width}}px',
|
||||
'Image.zoomIn': 'Zoom In',
|
||||
'Log.mustHaveSource': 'Must have source in config',
|
||||
'link': 'Link',
|
||||
'loading': 'Loading',
|
||||
'LocationPicker.placeholder': 'Pick location',
|
||||
|
@ -101,6 +101,7 @@ register('zh-CN', {
|
||||
'Image.sizeNotEqual': '请上传{{info}}的图片',
|
||||
'Image.width': '宽度 {{width}}px',
|
||||
'Image.zoomIn': '查看大图',
|
||||
'Log.mustHaveSource': '需要配置 Source',
|
||||
'link': '链接',
|
||||
'loading': '加载中',
|
||||
'LocationPicker.placeholder': '请选择位置',
|
||||
|
@ -93,7 +93,9 @@ export class Log extends React.Component<LogProps, LogState> {
|
||||
this.pauseOrResumeScrolling
|
||||
);
|
||||
}
|
||||
this.loadLogs();
|
||||
if (this.props.source) {
|
||||
this.loadLogs();
|
||||
}
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
@ -160,14 +162,20 @@ export class Log extends React.Component<LogProps, LogState> {
|
||||
|
||||
render() {
|
||||
const {
|
||||
source,
|
||||
className,
|
||||
classnames: cx,
|
||||
render,
|
||||
placeholder,
|
||||
height,
|
||||
translate: __
|
||||
} = this.props;
|
||||
|
||||
let loading = __(placeholder);
|
||||
|
||||
if (!source) {
|
||||
loading = __('Log.mustHaveSource');
|
||||
}
|
||||
|
||||
const lines = this.state.logs.map((line, index) => {
|
||||
return (
|
||||
<div className={cx('Log-line')} key={index}>
|
||||
@ -182,7 +190,7 @@ export class Log extends React.Component<LogProps, LogState> {
|
||||
className={cx('Log', className)}
|
||||
style={{height: height}}
|
||||
>
|
||||
{lines.length ? lines : __(placeholder)}
|
||||
{lines.length ? lines : loading}
|
||||
<div className={cx('Log-line')} key="last">
|
||||
<code>{this.state.lastLine}</code>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user