I can't seem to figure out the correct way to pass an array as a prop to a component in Vue, using Typescript and the class component library. Following the official template, I tried doing the following:
<script lang="ts">
import { Component, Vue} from 'vue-property-decorator';
const AppProps = Vue.extend({
props: {
propsMessage: String,
},
});
@Component({})
export default class Table extends AppProps {
mounted() {
console.log(this.propsMessage);
}
}
</script>
Including this in some template:
<template>
<Table :propsMessage="['This', 'is', 'Bob']" />
</template>
Does actually work, and gives the following output:
["This", "is", "Bob"]
Which is what I want, but this surely cannot be the correct way to pass arrays as props? I am not even defining the propsMessage as String[]. Doing some research, I found this article mentioning that there is a bug related to this issue. This issue has been fixed, and has been merged just recently. So, there should be a way to do this now, but I cannot find any documentation on how to do this correctly.