This post describes an situation, when you want to put component to your parent vue component. In this example parent component is App, and child component is Canvas.
Firstly, install a vue-class-component npm package.
Then for your Typescript class use annotation like this:
import Vue from 'vue';
import Component from 'vue-class-component';
import {Canvas} from "./Canvas";
@Component({
template: `<div><Canvas-component @element-added="addElement"></Canvas-component></div>`,
components: {
'Canvas-component': Canvas
}
})
export default class App extends Vue
...
Like this you can declare also props field like in vanilla js Vue component.
Firstly, install a vue-class-component npm package.
Then for your Typescript class use annotation like this:
import Vue from 'vue';
import Component from 'vue-class-component';
import {Canvas} from "./Canvas";
@Component({
template: `<div><Canvas-component @element-added="addElement"></Canvas-component></div>`,
components: {
'Canvas-component': Canvas
}
})
export default class App extends Vue
...
Like this you can declare also props field like in vanilla js Vue component.