As I write tsx in @vue/composition-api setup() function, like so:
<script lang="tsx">
import { defineComponent,} from '@vue/composition-api';
export defineComponent({
setup() {
const foo = {
bar: 1
baz: render() {return (<div>fooo</div>)}
}
return { foo }
}
})
</scirpt>
I encounter a warning message stating 'Vue warn]: Error in data(): "TypeError: Cannot read properties of undefined (reading '$createElement')"'
Upon inspecting the compiled code, I notice that there is a 'const h = this.$createElement' injected into the 'setup' function, as shown below:
setup(){
const h = this.$createElement
const foo = {
bar: 1
baz: render() {return h('div', 'fooo')}
}
}
This error occurs due to the lack of 'this' keyword within the setup function.
However, I am seeking a solution to this issue without having to move the tsx outside of the setup function.
(I am using vue-cli)