Skip to content

Commit d6ffe8b

Browse files
committed
fix(util): vm must have a setup function
1 parent ced16f0 commit d6ffe8b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/util/runtime.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ export function getRuntimeVM(): Vue {
1111
throw new ReferenceError('[vue-hooks] Not found vue instance.');
1212
}
1313

14-
export function setRuntimeVM(this: Vue, vm?: Vue) {
15-
runtime.vm = this || vm;
14+
export function setRuntimeVM(this: Vue, vue?: Vue) {
15+
const vm = this || vue;
16+
if (typeof vm.$options.setup === 'function') {
17+
runtime.vm = vm;
18+
}
1619
}

0 commit comments

Comments
 (0)