Fork me on GitHub

react_瞎敲

import {Component} from 'react';
import './index.less';
import {render} from 'less';

export default class MyDiv extends Componet{
    constructor(props){
        super(props);
        this.state = {
            content : props.news
        };
    }

    nextPage = () =>{
        this.state.content.nextPage && this.state.content.nextPage();  
    }

    render(){
        return (
            <div className = "my-div">   
                <div className = "my-div-top">
                    <div className = "mydiv-top-title"{this.state.content.name}></div>
                    <div className = "mydiv-top-right"><a onClick = {this.nextPage}> 下一页 </a> </div>
                </div>
                <div className = "my-div-content">  
                    {
                        (this.state.content.list || []).map((item,index) = > {
                            return ( <div className = "my-div-content-line"><a href = "javascript:;"
                            onClick = {() => { this.state.content.openUrl(index);}}>{item.title}</a><div>)
                            )
                        })}
                </div>
            </div>
        )
    }
}

 

posted @ 2021-03-27 22:25  ZZZZW  阅读(38)  评论(0编辑  收藏  举报
AmazingCounters.com