账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    引用Text组件,每次都需要使用styleSet设置样式,请问这段代码能不能优化下
    28
    0
    import React from 'react'
    class Text extends React.Component {
        constructor(props) {
            super(props);
            this.state = {number: 0};
        }
        componentDidMount() {
    
        }
        render() {
            return (
                <div className='text' style={this.props.styleSet}>
                    {this.props.text}
                </div>
            )
        }
    }
    
    
    export default Text;
    
    import React from 'react';
    import Texts from '../../../../components/Texts/';
    
    /**
     * 装备
     */
    class AbbottTest extends React.Component {
        constructor() {
            super();
    
            this.handleClick=this.handleClick.bind(this)
        }
    
        handleClick() {
            console.log('isRed')
            this.setState({isRed : !this.state.isRed});
            console.log(this.state.isRed)
    
        }
    
        render() {
            var divStyle ={
    
            }
    
            var redStyle = {
                display: 'block',
                width: 500,
                height: 500
            };
    
    
            var  blueStyle= {
                display: 'none'
            };
    
    
            return (
    
                <div style={divStyle} className='data-line'>
    
                    <Texts
                        styleSet={{
                            left: '765.5px',
                            top: '45px',
                            width: '389px',
                            height: '40px',
                            position: 'absolute',
                            fontSize: '28px',
                            color:'#FFFFFF'
                        }}
                        text={'北京电信IDC客户全国感知监控'}
                    />
    
                    <Texts
                        styleSet={{
                            left: '41.15px',
                            top: '174.86px',
                            width: '402px',
                            height: '30px',
                            position: 'absolute',
                            fontSize: '22px',
                            color:'#6FC4FF'
                        }}
                        text={'告警信息统计'}
                    />
    
                    <Texts
                        styleSet={{
                            left: '58.26px',
                            top: '758.41px',
                            width: '402px',
                            height: '30px',
                            position: 'absolute',
                            fontSize: '22px',
                            color:'#6FC4FF'
                        }}
                        text={'链路延时时间最高top10'}
                    />
    
                    <Texts
                        styleSet={{
                            left: '1467px',
                            top: '416.73px',
                            width: '402px',
                            height: '34px',
                            position: 'absolute',
                            fontSize: '22px',
                            color:'#6FC4FF'
                        }}
                        text={'链路丢包率最高top10'}
                    />
    
                </div>
    
    
            )
        }
    }
    
    export default AbbottTest;
    
    
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 唐朝小道 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部