Skip to content

Commit

Permalink
fixed option merge strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Ellis committed Mar 28, 2018
1 parent 7f38c49 commit b6b8281
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2.0.1
- Fixed an issue where doing `Vue.extend().use(vueInject)` meant vue inject could not find `optionMergeStrategies`

## 2.0.0
- Injecting components/mixins/directives is now optional
- There is now a default merging strategy for when using mixins with dependencies
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-inject",
"version": "2.0.0",
"version": "2.0.1",
"description": "Dependency Injection for Vue",
"main": "src/index.js",
"scripts": {
Expand Down
10 changes: 9 additions & 1 deletion src/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,15 @@ module.exports = function (Vue, options) {
});
}

Vue.config.optionMergeStrategies.dependencies = Vue.config.optionMergeStrategies.depnedencies || function (toVal, fromVal) {
function getOptionMergeStrategies(Vue) {
while (Vue && !Vue.config) {
Vue = Vue.super;
}
return (Vue && Vue.config && Vue.config.optionMergeStrategies) || {};
}

var mergeStrategies = getOptionMergeStrategies(Vue);
mergeStrategies.dependencies = mergeStrategies.depnedencies || function (toVal, fromVal) {
if (!toVal) {
return fromVal;
}
Expand Down

0 comments on commit b6b8281

Please sign in to comment.