import React, { Component } from 'react'; import { Button,Radio ,message,Row,Col, Spin,Pagination} from 'antd'; import axios from 'axios'; import './collection.less'; class Collection extends Component { constructor(props) { super(props); this.state = { loading:false, current:1, nub:'3' }; } loadData(page,nub){ this.setState({ loading:true, }) axios.get('https://www.apiopen.top/satinApi',{ params:{ type:1, page:page } }) .then(data=>{ let thisdata=data.data.data; this.setState({ loading:false, thisdata:thisdata, total:100 }) }) .catch(error=>{ message(error.error) }) } componentWillMount(){ this.loadData() } tabFun(e){ this.setState({ nub: e.target.value }) this.loadData(1,e.target.value) } //分页 onShowSizeChange(current, pageSize){ this.setState({ current:current, pageSize:pageSize }) this.loadData(current); } jump(item){ console.log(item); } render() { const thisdata =this.state.thisdata || []; thisdata.length=8; return
{item.text}
{item.name}