在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Linux  HTML/ 使用fetch抓取數(shù)據(jù)的時(shí)候,控制臺(tái)出現(xiàn)紅叉,怎么處理才能不顯示紅叉

使用fetch抓取數(shù)據(jù)的時(shí)候,控制臺(tái)出現(xiàn)紅叉,怎么處理才能不顯示紅叉

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ù)
                //通過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;

圖片描述

回答
編輯回答
熊出沒

你主動(dòng)把正常的log變?yōu)閑rror我也沒辦法啊
console.error(responseText) => console.log(responseText)

2018年8月2日 02:07