模拟数据mock

<script src="http://mockjs.com/dist/mock.js"></script>;
<script>
<script>
Mock.mock(/.json/, {
    'list|1-10': [{
        'id|+1': 1,
        'email': '@EMAIL'
    }]
})
$.ajax({
    url: 'hello.json',
    dataType: 'json'
}).done(function (data, status, jqXHR) {
    console.log(data)
})
</script>
原文地址:https://www.cnblogs.com/gggwf/p/8259549.html