1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Vue.jsのcomputedで引数を受ける

Posted at

たまに使うので忘備録として残します。

書き方

// 引数を取らない
const dataList = computed(() => {})

// 引数を取る
const dataList = computed(() => (arg) => {})

呼び方

呼び方は引数を取るからと言って何か変わる訳でも制限がある訳でもなく、普通のcomputedと同じ、computed内で呼んでもいいし、v-for内で呼んでもOK

const data = computed(() => dataList.value(arg))

<div v-for="a in ARRAY">
  {{ dataList(a) }} 
</div>
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?