Skip to content

Commit 867df25

Browse files
committed
@Component.mixins
1 parent 2eefcea commit 867df25

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ class Sup extends Base {
7474
directives:{
7575

7676
},
77+
//OPTION, mixins
78+
mixins:[{}],
7779
//OPTION, template string, [NEED VUE FULL BUILD](https://vuejs.org/api/options-rendering.html#template).
7880
template:'<div></div>',
7981
//OPTION, render function
@@ -268,6 +270,7 @@ export default defineComponent({
268270
);
269271
},
270272
beforeRouteEnter() {},
273+
mixins:[{}],
271274
template:'<div></div>',
272275
render(){
273276

src/component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ type ComponentOption = {
5959
modifier?: (raw: any) => any
6060
options?: ComponentCustomOptions & Record<string, any>
6161
template?: string
62+
mixins?: any[]
6263
}
6364
type ComponentConsOption = Cons | ComponentOption
6465
function ComponentStep(cons: Cons, extend?: any) {
@@ -70,7 +71,7 @@ function ComponentStepWithOption(cons: Cons, arg: ComponentOption, extend?: any)
7071
const slot = obtainSlot(cons.prototype)
7172

7273
Object.keys(arg).reduce<Record<string, any>>((option, name: string) => {
73-
if (['options', 'modifier','emits'].includes(name)) {
74+
if (['options', 'modifier', 'emits'].includes(name)) {
7475
return option
7576
}
7677
option[name] = arg[name as keyof ComponentOption]

test/component.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const FullOptionOpt = {
2626
inheritAttrs: true,
2727
expose: ['expose1', 'expose2'],
2828
modifier(option: any) {
29-
option.modifierCalled=true
29+
option.modifierCalled = true
3030
return option
3131
},
3232
render() {
@@ -35,7 +35,14 @@ const FullOptionOpt = {
3535
options: {
3636
test: 'test value'
3737
},
38-
template:'template string'
38+
template: 'template string',
39+
mixins: [{
40+
methods: {
41+
mixinMethod() {
42+
43+
}
44+
}
45+
}]
3946
}
4047

4148
@Component(FullOptionOpt)

0 commit comments

Comments
 (0)