Back to vue_devs

Reported Comment: "I like to put computed properties in the `setup`..."

Open
All reports for this content are collected in this issue. First reported on Jan 2, 2025 by miniatureDeafeningMysteriousTeacher
vue_devs

Original comment

1 report
cluse
cluse · posted 2 years ago
Context

I like to put computed properties in the setup function, in which case it looks like this:

const users = [
      { name: 'Alice', active: true },
      { name: 'Bob', active: false },
      { name: 'Carol', active: true }
    ]

const activeUsers = computed(() => {
  return users.filter(user => {
    return user.active;
  })
})

Activity Feed

Mod Actions

Please log in to access moderation features

Original Poster Actions

Please log in to access original poster features

Leave a comment

Markdown is supported