0
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?

Turbo Mount + Vue.js で、Pinia

Last updated at Posted at 2025-10-19

ここから先はミラーです。

Rails にTurbo Mount(gem)を導入して、Vue.jsのコンポーネントをHotwireと連携させる場合、Vue.jsのコンポーネントの中でPiniaを利用するには、turbo-mount/vue がデフォルト・エクスポートしているplugin をインポートし、pluginのmountComponentを上書きする必要があります。

piniaを複数コンポーネントで共有させるため、pluginのmountComponent内ではなく外で初期化しています。

この方法は Turbo Mount0.4.3 では有効ですが、将来のバージョンではTurbo Mount側の変更により無効になり、別の方法に
書き換える必要が出てくる可能性があります。

ERBの記述は、次のようになっています。

0
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
0
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?