@ButterflyEZ

Как перевести в $refs в массив?

Здравствуйте. Практикуясь, возникла такая ошибка, что TS ругается при попытки сделать массив из $refs.

Пробовал следующие варианты - коды ошибок:

1. Array.from(this.$refs.offers) - TS2488
Код ошибки

No overload matches this call.   

Overload 1 of 4, '(iterable: Iterable | ArrayLike): (Vue | Element)[]', gave the following error.     Argument of type 'Vue | Element | (Vue | Element)[] | undefined' is not assignable to parameter of type 'Iterable | ArrayLike'.       Type 'undefined' is not assignable to type 'Iterable | ArrayLike'.   Overload 2 of 4, '(arrayLike: ArrayLike): (Vue | Element)[]', gave the following error.     Argument of type 'Vue | Element | (Vue | Element)[] | undefined' is not assignable to parameter of type 'ArrayLike'.       Type 'undefined' is not assignable to type 'ArrayLike'


2. [...this.$refs.offers] - TS2769
Ошибка

TS2488: Type 'Vue | Element | (Vue | Element)[] | undefined' must have a '[Symbol.iterator]()' method that returns an iterator.


Как мне исправить это?
  • Вопрос задан
  • 90 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы