模拟数据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>
posted @ 2018-01-10 16:56  锅巴菜  阅读(118)  评论(0编辑  收藏  举报