Skip to content

Commit 9d64be7

Browse files
eddowktsn
authored andcommitted
Statics (#146)
* +statics * identation correction * -debugger * presentation * - function defaults
1 parent 0b710e6 commit 9d64be7

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Diff for: src/component.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,12 @@ export function componentFactory (
6565
const Super = superProto instanceof Vue
6666
? superProto.constructor as VueClass<Vue>
6767
: Vue
68-
return Super.extend(options)
68+
const Extended = Super.extend(options);
69+
70+
for(let staticKey in Component) {
71+
if(Component.hasOwnProperty(staticKey)) {
72+
Extended[staticKey] = Component[staticKey];
73+
}
74+
}
75+
return Extended;
6976
}

Diff for: test/test.ts

+9
Original file line numberDiff line numberDiff line change
@@ -274,4 +274,13 @@ describe('vue-class-component', () => {
274274
const vm: any = new MyComp()
275275
expect(vm.test).to.equal('foo')
276276
})
277+
278+
it('forwardStatics', function () {
279+
@Component
280+
class MyComp extends Vue {
281+
static myValue = 52
282+
}
283+
284+
expect(MyComp.myValue).to.equal(52);
285+
})
277286
})

0 commit comments

Comments
 (0)