Vue-admin工作整理(十七):Mock模拟Ajax请求

思路:使用Mock拦截actions请求,通过 Mock.mock(/\/getUserInfo/, 'post', getUserInfo) 进行拦截标示,然后将内容返回

export const getUserInfo = (options) => {
  console.log(options)
  // return {
  //   name: '小鸟'
  // }
  // return {
  //   name: 'Robin'
  // }

  // const template = { // 模版对象
  //   'str|2-4': 'Cristin', // 传一个属性名为str的 最小重复次数大于2最大重复次数小于4的string数据,string 数据值为 Cristin
  //   'name|3': 'Cristin', // String类型的属性,指定重复加载次数:3
  //   'age|+2': 18 // 数字类型的属性,自动+2,初始值为 18
  // }
  // let i = 3
  // let arr = []
  // while (i--) {
  //   arr.push(template)
  // }

 

转载于:https://www.cnblogs.com/cristin/p/9642965.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值