DEV Community

Discussion on: Building VueJS Applications with TypeScript

Collapse
 
tcmartin24 profile image
Terry

Awesome article George!

If I created another component in your project above, call it "CustomComponent", how could I reference it from within the html template of hello-world.html? In other words, I'd like to add something like:

<CustomComponent />

inside of hello-world.html. How could I do that? I know you mentioned you'd write an article in the future that would mention child components, but I'd really like to learn how to do that ASAP because your article has inspired my team to try your approach immediately but I'm stuck on this question.

Thanks again for the excellent article,
T.

Collapse
 
georgehanson profile image
George Hanson

Thanks!

Keep checking back, I'm working on something soon! :)

In response to your question, you can do something like this:

import { Component, Vue } from 'vue-property-decorator';
import WithRender from './hello-world.html';
import CustomComponent from './CustomComponent.ts';

@WithRender
@Component({
    components: {
        CustomComponent
    }
})
export default class HelloWorld extends Vue {

That would then make it available for use within that particular component.

Collapse
 
georgehanson profile image
George Hanson

Hi Terry,

I've just published part two - dev.to/georgehanson/building-vue-j...