11. react analog interface based on the use of data charles

charles reference test document

charles official website

Analog data

  Simulation data requested axios

    eg:

    1. Preparation of axios request 

      axios.get('/api/xxx')

        .then(()=>{alert('succ')})

        .catch(()=>{alert('err')})

    2. Create a file in xxx.json Desktop (Desktop)

      cd ~/Desktop

      touch xxx.json

    3. Edit xxx.json

      ["zone", "hoo"]

    When data is returned in the initiation request xxx.json 4. axios

      Select charles

      Select the top Tools

      Select Map Local ...

      Add Select Enable Map Local

      Click Add

        Protocol : http

        Host : localhost

        Port : 3000

        Path : /api/xxx

        Query :

        Local path : ~/Desktop/xxx.json

    5. Access http: // localhost: 3000 / api / xxx

    6. The initial value given in conjunction this.setState

      this.axios.get('/api/xxx')

        .then((res)=>{

          this.setState(()=>({  

            list : [...res.data]

          }))

 

        })

      

Guess you like

Origin www.cnblogs.com/zonehoo/p/11647134.html