Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
TypeError: no se pueden leer las propiedades de undefined (leyendo 'agregar') en vuejs

Se está produciendo un error debido a esta línea "word.classList.add('tag')". Cuando agregué por primera vez una clase aquí "if (word.includes('@')) {}", recibí el mismo error, así que pensé que tenía que insertar palabras en una nueva matriz y repetirlas, pero el problema es algo más.

 export default { data() { return { tweets: [], currentPage: 1, numberOfPages: 0, showPagination: 5, newPage: 0, text: [], arrayOfWords: [], } }, methods: { getTweets(newCurrent) { this.tweets = [] const API_URL = `${this.$server}/api/twitter/tweets` const params = { token: getUserToken(), page: this.$route.query.page, newCurrentPage: newCurrent, } axios.post(API_URL, null, { params }).then(res => { this.currentPage = res.data.page this.numberOfPages = res.data.numberOfPages res.data.tweets.forEach(tweet => { const tweetData = { id: tweet.id, tweet_text: tweet.tweet_text, twitter_name: tweet.twitter_name, twitter_username: tweet.twitter_username, added_at: moment(String(tweet.added_at)).format('MM/DD/YYYY hh:mm'), } this.tweets.push(tweetData) this.text.push(tweet.tweet_text) }) this.tweets.forEach(tweet => { tweet.tweet_text.split(' ').forEach(word => { if (word.includes('@')) { this.arrayOfWords.push(word) } }) }) this.arrayOfWords.forEach(word => { word.classList.add('tag') console.log(word) }) }) }, }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

word es una cadena, creo que no tiene classList , puede agregarle classList si lo desea

 word.classList = word.classList || []
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!