会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132485个问题

新建文本文档.zip

计算机怎么写计算正负,求指导!

Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 21946楼

批注 2020-09-23 215202.png

老师我看不了Headers里的内容怎么解决了

JAVA 全系列/第二阶段:JAVA 基础深化和提高/手写服务器项目(旧) 21947楼
Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 21950楼
Python 全系列/第十二阶段:Python_Django3框架/Django进阶 21952楼

//fetch和动态渲染

import React from 'react'

export default class Fetch extends React.Component{

    constructor(props){

        super(props)

        this.state={

            list:''//初始化list的值

        }

    }

    //动态渲染

    componentDidMount(){

        fetch('http://iwenwiki.com/api/blueberrypai/getIndexMovement.php')

        .then(src=>src.json())

        .then(data=>{

            this.setState({

                list:data

            })

            console.log(data);

            console.log(this.state.list.movement[0].title);

            

        })

    }

//     模拟get

//    get(){

//         fetch('http://iwenwiki.com/api/blueberrypai/getBlueBerryJamInfo.php',{data:'参数'})//第二个参数可以传参

//         .then(src=>src.json())

//         .then(data=>{console.log(data)})

//     }


//     模拟post

//     post(){

//         fetch('http://iwenwiki.com/api/blueberrypai/getBlueBerryJamInfo.php',{

//             method:'POST',

//             body:"msg_code:10000&userid:aays",//fetch接收的参数,必须是字符串类型

//             headers:new Headers({//请求头

//                 'Accept':'application/json,text/plain,*/*',//访问权限

//                 'Content-Type':'application/json'//内容类型

//             }),

//         })

//         .then(src=>src.json())

// .then(data=>{console.log(data);})

//     }


    render(){

        // const {list}=this.state//即调用list的时候自动变成this.state.list

    return(

        <div>

            

            {/* <button onClick={this.get}>Fectch用get获取数据</button>

        <button onClick={this.post}>Fetch用post获取数据</button> */}

{

this.state.list.movement.map((element,index)=>{

    return(

        <ul>

            <li>element.title</li>

            <li></li>

            <li></li>

        </ul>

    )

})

}

        </div>

    )

}

}

image.png

WEB前端全系列/第十四阶段:React知识体系/React基础知识 21953楼
JAVA 全系列/第九阶段:Spring Boot实战/Spring Boot 21955楼
JAVA 全系列/第十二阶段:消息中间件(异步消息传递)/ActiveMQ 21956楼
WEB前端全系列/第十三阶段:微信小程序-安心食疗(旧)/安心食疗-定位-搜索 21957楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/网络编程 21959楼
WEB前端全系列/第六阶段:音乐社区高级项目模块/移动端:基于jQuery使用Ajax和BootStrap 21960楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637