Blame view

component/v2/plugins/index.js 376 Bytes
d46806b9     结构调整
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import preset from './preset/index'

export default {
  installed: [...preset],
  use(plugin) {
    if (typeof plugin !== 'function') return
    const info = plugin() || {}
    const { name } = info
    if (
      name &&
      name !== 'methods' &&
      !this.installed.some(p => p[0] === name)
    ) {
      this.installed.unshift([name, info])
    }
    return this
  }
}