index.js 376 B

123456789101112131415161718
  1. import preset from './preset/index'
  2. export default {
  3. installed: [...preset],
  4. use(plugin) {
  5. if (typeof plugin !== 'function') return
  6. const info = plugin() || {}
  7. const { name } = info
  8. if (
  9. name &&
  10. name !== 'methods' &&
  11. !this.installed.some(p => p[0] === name)
  12. ) {
  13. this.installed.unshift([name, info])
  14. }
  15. return this
  16. }
  17. }