Skip to content

Commit

Permalink
fix(util): vm must have a setup function
Browse files Browse the repository at this point in the history
  • Loading branch information
u3u committed Jul 9, 2019
1 parent ced16f0 commit d6ffe8b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/util/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export function getRuntimeVM(): Vue {
throw new ReferenceError('[vue-hooks] Not found vue instance.');
}

export function setRuntimeVM(this: Vue, vm?: Vue) {
runtime.vm = this || vm;
export function setRuntimeVM(this: Vue, vue?: Vue) {
const vm = this || vue;
if (typeof vm.$options.setup === 'function') {
runtime.vm = vm;
}
}

0 comments on commit d6ffe8b

Please sign in to comment.