React simulates mock

I used mock to simulate a piece of data
let list = Mock.mock ("/ pie", {

)
moni:{
    salesTypeData:[
        {
          x: 0,
          y: "2018-5-10",
        },
        {
          x: 20,
          y: "2018-5-11",
        },
        {
          x: 40,
          y: "2018-5-12",
        },
        {
          x: 60,
          y: "2018-5-13",
        },
        {
          x: 80,
          y: "2018-5-14",
        },
        {
          x: 100,
          y: "2018-5-15",
        },
        {
            x: 120,
            y: "2018-5-16",
          },
      ]
}
 

})

export default {

list,

};
I don"t know if this is the right way to write it

clipboard.png
fetch
undefined
clipboard.png


module.exports = {
  code: "0", //0
  msg: "success",
  data: {
      ...   
  }
};

but it is recommended to use remote, after all, everyone can use it. https://easy-mock.com/login


mockjs does not support fetch,. You can use other ajax such as jquery's ajax to access it

Menu