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> ) } }
---- 动动手指关注我!或许下次你又能在我这里找到你需要的答案!ZZZZW与你一起学习,一起进步!