Vue instance using classes

前端 未结 2 1098
星月不相逢
星月不相逢 2020-12-20 19:44

I\'m new to Vue and have a few questions on it. But I think the issue I am running is the one I have no idea how to solve it:

I have a few

2条回答
  •  旧巷少年郎
    2020-12-20 20:28

    Additionally, if you want to access the html from your js/ts files, you can use vue's ref system.

    example:

    
    

    example.js:

    var myExampleDiv = this.$refs.example;
    

    or if your using typescript

    example.ts:

    const myExampleDiv = this.$refs.example as HTMLElement;
    

    For more information on this: https://vuejs.org/v2/api/#vm-refs

提交回复
热议问题