# 2019.04.16

[新闻] Chrome 75 将默认启用延迟加载功能:https://addyosmani.com/blog/lazy-loading/ (opens new window)

[视频] 基于 Umi 封装自己的框架:https://www.bilibili.com/video/av47877835 (opens new window)

[类库] Ajx 是一个 JSON 数据格式校验库,实战案例 (opens new window)https://github.com/epoberezkin/ajv (opens new window)

[工具] Docz 用 MDX 写 React UI 组件文档,参考文章 (opens new window)https://github.com/pedronauck/docz/ (opens new window)

# 配图 - Docz

# 示例 - Ajx

const Ajv = require('ajv');
const ajv = new Ajv({allErrors: true});

const schema = {
  "properties": {
    "foo": { "type": "string" },
    "bar": { "type": "number", "maximum": 3 }
  }
};

const validate = ajv.compile(schema);

test({"foo": "abc", "bar": 2});
test({"foo": 2, "bar": 4});

function test(data) {
  var valid = validate(data);
  if (valid) console.log('Valid!');
  else console.log('Invalid: ' + ajv.errorsText(validate.errors));
}

# 今日配图

Last Updated: 11/8/2019, 3:10:17 PM