鍍金池/ 問(wèn)答/Linux  HTML/ 使用fecth抓取數(shù)據(jù)的時(shí)候顯示紅叉,怎么才能去掉

使用fecth抓取數(shù)據(jù)的時(shí)候顯示紅叉,怎么才能去掉

import React, { Component } from 'react';
import fetch from 'isomorphic-fetch';

class DataSource extends React.Component {// 初始化模擬數(shù)據(jù)

    constructor(props) {
        super(props);

        this.state = {

            load:false,
            text:''
        };
    }

    //耗時(shí)操作放在這里面
    componentDidMount(){
        //this.getNet();
    }

    getNet(){
        fetch('http://gank.io/api/search/query/listview/category/福利/count/10/page/1')//請(qǐng)求地址
            .then((response) => response.json())//取數(shù)據(jù)
            .then((responseText) => {//處理數(shù)據(jù)
                //通過(guò)setState()方法重新渲染界面
                console.error(responseText)

            })
            .catch((err) => console.error(err));
    }

    render() {

            return (
                <div className="square" onClick={() => this.getNet()}>
                    獲取網(wǎng)絡(luò)內(nèi)容
                </div>
            );

    }
}

export default DataSource;

圖片描述

回答
編輯回答
不舍棄

使用 console.log()
clipboard.png

2017年3月19日 00:53