Skip to content

Commit c77f903

Browse files
committed
should inherit component class and vue to pass babel's instance type check
1 parent 0a11308 commit c77f903

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/component.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,12 @@ export function componentFactory (
6565

6666
// find super
6767
const superProto = Object.getPrototypeOf(Component.prototype)
68-
const Super: VueClass = superProto instanceof Vue
69-
? superProto.constructor as VueClass
70-
: Vue
71-
return Super.extend(options)
68+
if (!(superProto instanceof Vue)) {
69+
Component.prototype = Object.create(Vue.prototype)
70+
Component.prototype.constructor = Component
71+
Object.keys(Vue).forEach(key => {
72+
Component[key] = Vue[key]
73+
})
74+
}
75+
return Component.extend(options)
7276
}

0 commit comments

Comments
 (0)