引用模块

Commonjs

  1. const Mock = require("mockjs"); // 导入Mock模块

ES6

浏览器

  1. <script type="text/javascript" src="http://mockjs.com/dist/mock.js"></script>
  1. const data = Mock.mock("@id");
  2. console.log(data);