Multiple components in Vue.use

Asked

Viewed 44 times

1

I’m using these components in my code

Vue.use(Toaster, {timeout: 5000})
Vue.use(VueAlert)
Vue.use(VueSweetAlert)

Is there any way I can connect these three into one Vue.use ?

Something like that (incorrect)

Vue.use([
         { Toaster, {timeout: 5000} },
         { VueAlert },
         { VueSweetAlert }
        ])

Thank you!

  • I may be wrong, but I don’t think it’s possible.

1 answer

2


Note the native method

/* @flow */

import { toArray } from '../util/index'

export function initUse (Vue: GlobalAPI) {
  Vue.use = function (plugin: Function | Object) {
const installedPlugins = (this._installedPlugins || (this._installedPlugins = []))

Vue.use receives only one object or a function, it is not possible to pass multiple objects :/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.