1

I have a child component

 <student-list
   ref="studentList"
   :all-students="allStudent"
                    
 />

What I like to do is gab the html from this list and reuse it

const studentInformation = this.$refs.studentList.$refs[id][0].$el.outerHTML

This works fine until making the component TS, I get the error

Property '$refs' does not exist on type 'Vue

I tried any

  const studentInformation: any =  this.$refs.studentList.$refs[id][0].$el.outerHTML

    |                                                             ^^^^^

html element

const studentInformation: any =  this.$refs.studentList.$refs[id][0].$el.outerHTML as HTMLElement

and vue

const studentInformation: any = (this.$refs.studentList.$refs as Vue)[id][0].$el.outerHTML as HTMLElement

Any help would be appreciated I am using the options api.

TommyD
  • 913
  • 3
  • 17
  • 32

0 Answers0