add fetchjs

This commit is contained in:
zuiidea
2016-09-16 23:37:43 +08:00
parent a0c6554d46
commit c576487d22
3 changed files with 28 additions and 16 deletions
+3 -2
View File
@@ -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
View File
@@ -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
View File
@@ -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" />