Skip to content

Commit b80b969

Browse files
pshrmneddyerburgh
authored andcommitted
feat(createLocalVue): allow additional arguments in use (vuejs#100)
* Allow additional arguments in use * Whitespace
1 parent da24ff4 commit b80b969

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Diff for: src/create-local-vue.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ function createLocalVue (): Component {
3030

3131
// compat for vue-router < 2.7.1 where it does not allow multiple installs
3232
const use = instance.use
33-
instance.use = (plugin) => {
33+
instance.use = (plugin, ...rest) => {
3434
plugin.installed = false
3535
plugin.install.installed = false
36-
use.call(instance, plugin)
36+
use.call(instance, plugin, ...rest)
3737
}
3838
return instance
3939
}

Diff for: test/unit/specs/create-local-vue.spec.js

+11
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,15 @@ describe('createLocalVue', () => {
9595
const freshWrapper = mount(Component)
9696
expect(typeof freshWrapper.vm.$route).to.equal('undefined')
9797
})
98+
99+
it('use can take additional arguments', () => {
100+
const localVue = createLocalVue()
101+
const pluginOptions = { foo: 'bar' }
102+
const plugin = {
103+
install: function (_Vue, options) {
104+
expect(options).to.equal(pluginOptions)
105+
}
106+
}
107+
localVue.use(plugin, pluginOptions)
108+
})
98109
})

0 commit comments

Comments
 (0)