-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support for class component mixins (#334)
Fix for using class component with mixins and also for importing Vue from vue-property-decorator instead of vue-class-component. Co-authored-by: Evert van der Weit <evert@mett.nl>
- Loading branch information
1 parent
af80ab0
commit 76dfcad
Showing
6 changed files
with
67 additions
and
4 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
e2e/__projects__/basic/components/ClassComponentProperty.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<template> | ||
<div class="hello"> | ||
<h1 data-computed>{{ computedMsg }}</h1> | ||
<h2 data-props>{{ msg }}</h2> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Vue, Prop } from 'vue-property-decorator' | ||
export default class ClassComponent extends Vue { | ||
dataText: string = 'Hello' | ||
@Prop() msg!: string | ||
get computedMsg(): string { | ||
return `Message: ${this.dataText}` | ||
} | ||
} | ||
</script> |
12 changes: 12 additions & 0 deletions
12
e2e/__projects__/basic/components/ClassComponentWithMixin.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<template> | ||
<div class="hello"> | ||
<h1 data-mixin>{{ message }}</h1> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { mixins } from 'vue-class-component' | ||
import ClassMixin from './ClassMixin' | ||
export default class ClassComponent extends mixins(ClassMixin) {} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { Vue } from 'vue-class-component' | ||
|
||
export default class ClassMixin extends Vue { | ||
message = 'Hello world!' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76dfcad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The matching rules of "vue-class-component" are too simple.
If this words exists in the vue file and not import format, the unit test will fail and the VM cannot be rendered.
Such it's a comments or a plain text;
<template> vue-class-component </template>