Nuxt.js(Vue.js)

Nuxt.js computed()の共通利用

Nuxt.js

コーディング

UIで入力されるフォームのInputのデータを使い回す例

GetExampleQueryVariables, RegisterExampleByInputMutationVariablesで使いまわしたかった時

const commonInput = computed(() => {
  return {
    limit: fetchLimit,
    page: currentPage.value,
    sortKey: sortKey.value,
    sortOrder: sortOrder.value,
  }
})
const getExampleQueryVariables = computed(() => {
  return {
    input: commonInput.value,
  }
}) as GetExampleQueryVariables
const registerExampleByInputMutationVariables = computed(() => {
  return {
    input: commonInput.value,
  }
}) as RegisterExampleByInputMutationVariables

 

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)