鍍金池/ 問答/HTML5  網(wǎng)絡(luò)安全  HTML/ 模擬mock數(shù)據(jù)

模擬mock數(shù)據(jù)

clipboard.png
模擬的數(shù)據(jù)
clipboard.png
控制臺輸出的數(shù)據(jù)
感覺哪有問題
請問有人知道怎么模擬嗎

回答
編輯回答
故林

數(shù)據(jù)是你需要調(diào)用這個接口后返回的數(shù)據(jù)

https://codepen.io/jx915/pen/...

2017年9月7日 09:45
編輯回答
尛曖昧
// 使用 Mock
var Mock = require('mockjs'); // 你打包的時候自己改成import Mock from 'mockjs'
var data = Mock.mock({
  // 屬性 list 的值是一個數(shù)組,其中含有 1 到 10 個元素
  'list|1-10': [{
    'number1|1-100.1-10': 1,
    'number2|123.1-10': 1,
    'number3|123': 1,
    'number4|123.10': 1.123
  }]
})

console.log(JSON.stringify(data,null, 4))
2017年5月12日 13:56