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

回答編集履歴

1

2 のサンプルコードをVueインスタンス内のコードであることが分かるよう修正

2021/10/28 08:25

投稿

you-5805
you-5805

スコア2

answer CHANGED
@@ -31,7 +31,11 @@
31
31
  Vue.prototype.$axios = axios;
32
32
 
33
33
  // 2. in MyPage.vue
34
+ new Vue({
35
+ beforeCreate: () => {
34
- this.$axios.get('/user').then( ~~~
36
+ this.$axios.get('/user').then( ~~~
37
+ },
38
+ });
35
39
  ```
36
40
 
37
- もし参考になれば ????
41
+ Vueを普段書かないので 2 のサンプルコードが変かもしれませんが、もし参考になれば ????