teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

追記

2023/01/19 15:55

投稿

maroniel
maroniel

スコア15

answer CHANGED
@@ -48,8 +48,17 @@
48
48
  import { useAlertStore } from '../store/alert';
49
49
  const alertStore = useAlertStore(pinia);
50
50
  ```
51
- 以下だとうく行かない
51
+ たはこう
52
52
  ```
53
+ import { setActivePinia } from 'pinia'
54
+ import pinia from '../store'
55
+ setActivePinia(pinia)
56
+ import { useAlertStore } from '../store/alert';
57
+ const alertStore = useAlertStore();
58
+ ```
59
+
60
+ 以下とかだとうまく行かない
61
+ ```
53
62
  import { createPinia } from 'pinia'
54
63
  const pinia = createPinia()
55
64
  import { useAlertStore } from '../store/alert';