Skip to content

Commit 73f4e4c

Browse files
author
fmdm
committed
+statics
1 parent 0ca7db0 commit 73f4e4c

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/component.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,17 @@ export function componentFactory (
5757
const decorators = (Component as DecoratedClass).__decorators__
5858
if (decorators) {
5959
decorators.forEach(fn => fn(options))
60-
}
60+
}
6161

6262
// find super
6363
const superProto = Object.getPrototypeOf(Component.prototype)
6464
const Super = superProto instanceof Vue
6565
? superProto.constructor as VueClass
6666
: Vue
67-
return Super.extend(options)
67+
const rv = Super.extend(options);
68+
69+
for(let sttc in Component)
70+
if(!(sttc in function() {}) && Component.hasOwnProperty(sttc))
71+
rv[sttc] = Component[sttc];
72+
return rv;
6873
}

test/test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,14 @@ describe('vue-class-component', () => {
256256
expect(parent.value).to.equal('parent')
257257
expect(child.value).to.equal('child')
258258
})
259+
260+
it('forwardStatics', function () {
261+
debugger;
262+
@Component
263+
class MyComp extends Vue {
264+
static myValue = 52
265+
}
266+
267+
expect(MyComp.myValue).to.equal(52);
268+
})
259269
})

0 commit comments

Comments
 (0)