亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我想問一下為什么我調用后端的接口,但在瀏覽器中顯示不出來數據,是可以在控制臺中顯示出來的

我想問一下為什么我調用后端的接口,但在瀏覽器中顯示不出來數據,是可以在控制臺中顯示出來的

慕碼人1183263 2016-12-16 16:47:03
我的js代碼如下:import React from 'react';import ReactDOM from "react-dom";import reqwest from 'reqwest';import {Table} from 'antd';? ? const columns = [{? ? ? title:'id',? ? ? dataIndex:'id',? ? ? key:'1'? ? },{? ? ? title:'姓名',? ? ? dataIndex:'name',? ? ? key:'2'? ? },{? ? ? title:'性別',? ? ? dataIndex:'gender',? ? ? key:'3'? ? },{? ? ? title:'生日',? ? ? dataIndex:'birthday',? ? ? key:'4'? ? },{? ? ? title:'籍貫',? ? ? dataIndex:'origo',? ? ? key:'5'? ? },{? ? ? title:'職責',? ? ? dataIndex:'duty',? ? ? key:'6'? ? },{? ? ? title:'圖像',? ? ? dataIndex:'url',? ? ? key:'7'? ? },{? ? ? title:'userId',? ? ? dataIndex:'userId',? ? ? key:'8'? ? }];? ? const Test = React.createClass({? ? ? ? render() {? ? ? ? ? const datas=[];? ? ? ? ? reqwest({? ? ? ? ? ? url: 'http://172.30.140.113:8080/person',? ? ? ? ? ? method: 'get',? ? ? ? ? ? type: 'json',? ? ? ? ? }).then((data) => {? ? ? ? ? ? console.log(data);//這里在控制臺可以顯示數據的? ? ? ? ? ? for(let i=0;i<data.length;i++){? ? ? ? ? ? ? ? datas.push({? ? ? ? ? ? ? ? key:i+1,? ? ? ? ? ? ? ? id:data[i].id,? ? ? ? ? ? ? ? name:data[i].name,? ? ? ? ? ? ? ? url:data[i].avatar,? ? ? ? ? ? ? ? gender:data[i].gender,? ? ? ? ? ? ? ? birthday:data[i].birthday,? ? ? ? ? ? ? ? origo:data[i].origo,? ? ? ? ? ? ? ? duty:data[i].duty,? ? ? ? ? ? ? ? userId:data[i].userId? ? ? ? ? ? ? });? ? ? ? ? ? }? ? ? ? ? ? console.log(datas);//同樣這里在控制臺也是可以顯示數據的? ? ? ? ? });? ? ? ? return (? ? ? ? ? <Table bordered columns={columns}? ? ? ? ? ? dataSource={datas}/>? ? ? ? );? ? ? },? ? });? ? ReactDOM.render(<Test />, document.getElementById('root'));最終在瀏覽器中顯示的結果是:首先是我的代碼編譯沒有出錯的,可以連接到后端端口顯示數據的,在控制臺那里可以看到顯示的數據,但不知道為什么用antd的Table就顯示不出來,可以幫幫我解決嗎?
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 4140 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號