mirror of
https://github.com/zuiidea/antd-admin
synced 2026-10-29 12:37:20 +00:00
add fetchjs
This commit is contained in:
+3
-2
@@ -47,7 +47,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"extract-text-webpack-plugin": "^1.0.1",
|
||||
"superagent": "2.0.0"
|
||||
"superagent": "2.0.0",
|
||||
"whatwg-fetch": "^1.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "webpack --progress --colors --display-error-details",
|
||||
@@ -58,4 +59,4 @@
|
||||
"stylelint": "stylelint \"src/**/*.css\"",
|
||||
"lesshint": "lesshint src/"
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -1,6 +1,7 @@
|
||||
import config from 'config';
|
||||
import ajax from './ajax';
|
||||
import Logger from './Logger';
|
||||
import './lib.less';
|
||||
import config from 'config'
|
||||
import ajax from './ajax'
|
||||
import Logger from './Logger'
|
||||
import 'whatwg-fetch'
|
||||
import './lib.less'
|
||||
|
||||
module.exports = {ajax,config,Logger};
|
||||
module.exports = {ajax,config,Logger}
|
||||
|
||||
+19
-9
@@ -8,7 +8,10 @@ const logger = Logger.getLogger('List')
|
||||
|
||||
let List = React.createClass({
|
||||
getInitialState() {
|
||||
logger.info()
|
||||
const tableName = this.props.routes.pop().tableName
|
||||
return {
|
||||
tableName,
|
||||
pager:{
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
@@ -24,6 +27,11 @@ let List = React.createClass({
|
||||
fetch() {
|
||||
const _this = this
|
||||
this.setState({loading: true})
|
||||
|
||||
fetch('https://randomuser.me/api/')
|
||||
.then(function(response) {
|
||||
console.log(response);
|
||||
})
|
||||
// Ajax({
|
||||
// url: contextPath + '/talent/index',
|
||||
// data: {
|
||||
@@ -39,17 +47,19 @@ let List = React.createClass({
|
||||
},
|
||||
render() {
|
||||
return (
|
||||
<Table
|
||||
bordered
|
||||
columns={columns}
|
||||
rowKey={record => record.id}
|
||||
dataSource={this.state.data}
|
||||
pagination={this.state.pager}
|
||||
loading={this.state.loading}
|
||||
onChange={this.handleTableChange}
|
||||
size="small" />
|
||||
<div />
|
||||
)
|
||||
},
|
||||
})
|
||||
|
||||
module.exports = List
|
||||
|
||||
// <Table
|
||||
// bordered
|
||||
// columns={columns}
|
||||
// rowKey={record => record.id}
|
||||
// dataSource={this.state.data}
|
||||
// pagination={this.state.pager}
|
||||
// loading={this.state.loading}
|
||||
// onChange={this.handleTableChange}
|
||||
// size="small" />
|
||||
|
||||
Reference in New Issue
Block a user