Nuxt useState

useState を利用して一時的な共有状態を取得・設定できます。

URI state://{key}
Path

useState キー

Example state://basic

ViewState

Retrieve and Update

Src 属性に state://{key} を指定して、一時的な状態をコンポーネント間で共有できます。

vue
<template>
 <ViewState
  v-slot="example"
  src="state://basic"
 >
  <b-input
   :state-src="example"
   state-path="key1"
  />
  <b-input
   :state-src="example"
   state-path="key2"
  />
  <div>{{ example.data }}</div>
 </ViewState>
</template>