Skip to content

Commit

Permalink
refactor: convert src/courses/components/MusicScoreRender.vue from cl…
Browse files Browse the repository at this point in the history
…ass-based to Options/Composition API (#511)

Summary:
This was a straightforward conversion of a simple component. The main
changes were:
1. Removing class-based decorators
2. Using defineComponent for better type inference
3. Converting the class structure to the Options API format
4. Making the prop required since it's used in mounted() without a
default value

Warnings:
No warnings - this component had no inheritance or complex class-based
features that would cause issues in conversion.
  • Loading branch information
NiloCK authored Jan 7, 2025
2 parents 2a738e9 + edc8f45 commit bcd95e2
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions packages/vue/src/courses/components/MusicScoreRender.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@

<script lang="ts">
import abc from 'abcjs';
import Component from 'vue-class-component';
import { Prop, Vue } from 'vue-property-decorator';
import { defineComponent } from 'vue';
@Component({})
export default class MusicScoreRenderer extends Vue {
@Prop() public abcString: string;
export default defineComponent({
name: 'MusicScoreRenderer',
public mounted() {
props: {
abcString: {
type: String,
required: true
}
},
mounted() {
abc.renderAbc('abc', this.abcString);
}
}
});
</script>

<style>
Expand Down

0 comments on commit bcd95e2

Please sign in to comment.