Skip to content

Latest commit

 

History

History
11 lines (11 loc) · 492 Bytes

20181120.md

File metadata and controls

11 lines (11 loc) · 492 Bytes

如果你真的需要重复很多次的元素/组件,你可以使用工厂函数来实现。例如,下面这个例子 render 函数完美有效地渲染了 20 个相同的段落:

render: function (createElement) {
  return createElement('div',
    Array.apply(null, { length: 20 }).map(function () {
      return createElement('p', 'hi')
    })
  )
}