this.columns = [{ title: 'picture', dataIndex:'imgPath', // 網頁加載出來只有這個路徑 /img/images/a.jpg // dataIndex不能這塊不能拼接路徑 // 需要加載的鏈接 http:127.0.0.1/img/images/a.jpg // 并且把加載的這個圖片路徑轉換成圖片,需要怎么轉換? },]//這樣獲取json數據的,這塊好像不能更改。fetch(json) .then(res => res.json()) .then( (result) => { this.setState({ isLoaded: true, dataType:'JSONP', dataSource: result.data.list, }); }, (error) => { this.setState({ isLoaded: true, error }); } )render() { const { dataSource } = this.state;const columns = this.columns;return ( <div> <Table bordered rowKey="kid" dataSource={dataSource} columns={columns} /> </div>);
react的antd中怎樣把獲取的json圖片路徑轉換成圖片加載到頁面中?
拉莫斯之舞
2019-02-14 22:19:03