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

質問編集履歴

3

コード修正

2018/01/27 19:45

投稿

SystemRyota
SystemRyota

スコア24

title CHANGED
File without changes
body CHANGED
@@ -24,9 +24,9 @@
24
24
  axios.get(url, {
25
25
  params: {/* ... */}
26
26
  })
27
- .then(red => {
27
+ .then(res => {
28
28
  if (res.data) {
29
- this.arr = res.data
29
+ this.parent.arr = res.data
30
30
  }
31
31
  })
32
32
  }

2

コードの追加

2018/01/27 19:45

投稿

SystemRyota
SystemRyota

スコア24

title CHANGED
File without changes
body CHANGED
@@ -15,6 +15,21 @@
15
15
  arr: [/* ... */]
16
16
  }
17
17
  }
18
+ },
19
+ mounted() {
20
+ this.getArr()
21
+ },
22
+ methods: {
23
+ getArr() {
24
+ axios.get(url, {
25
+ params: {/* ... */}
26
+ })
27
+ .then(red => {
28
+ if (res.data) {
29
+ this.arr = res.data
30
+ }
31
+ })
32
+ }
18
33
  }
19
34
  </script>
20
35
  ```

1

コメント変更

2018/01/27 19:42

投稿

SystemRyota
SystemRyota

スコア24

title CHANGED
File without changes
body CHANGED
@@ -29,7 +29,7 @@
29
29
  arr: Array
30
30
  },
31
31
  mounted() {
32
- console.log(this.arr) // undefined
32
+ console.log(this.arr) // [__ob__: Observer] (データは存在しない)
33
33
  console.log(this.$props.arr) // undefined
34
34
  console.log(this.$parent.parent.arr) // undefined
35
35
  }