ElementUi table default selected question?

I wrote it according to the official demo. As a result, the error reporting method toggleRowSelection does not exist

related codes

this.line.siteArr.forEach (item = > {

)
    this.siteArr.forEach((val, index) => {
      if (item.siteId === val.siteId) {
        val.siteType = item.siteType
        this.$refs.siteArr.toggleRowSelection(val,true)
      }
    })
  })

Cannot read property "toggleRowSelection" of undefined

Apr.16,2021

if you need to use $nextTick, after modifying the table data, you can get the updated DOM in the callback; you need to change it to: this.$nextTick (function () {this.$refs.siteArr.toggleRowSelection (val,true);} .bind (this));

Menu