質問編集履歴

5

修正

2018/03/24 10:01

投稿

massy7
massy7

スコア45

test CHANGED
File without changes
test CHANGED
@@ -30,11 +30,7 @@
30
30
 
31
31
  .then(function (response) {
32
32
 
33
- return {
34
-
35
- data: data
33
+ data = response
36
-
37
- }
38
34
 
39
35
  })
40
36
 
@@ -42,13 +38,15 @@
42
38
 
43
39
  console.log(error)
44
40
 
45
- return {
46
-
47
- data: null
41
+ data = null;
48
-
49
- }
50
42
 
51
43
  })
44
+
45
+ return {
46
+
47
+ data: data
48
+
49
+ }
52
50
 
53
51
  ```
54
52
 

4

追記

2018/03/24 10:01

投稿

massy7
massy7

スコア45

test CHANGED
File without changes
test CHANGED
@@ -15,6 +15,42 @@
15
15
  ### 発生している問題
16
16
 
17
17
  `<nuxt-link class="button" to="/">Index</nuxt-link>`を利用した場合正常にルーティングされるが、URL直打ち、リロード等でアクセスすると404になる
18
+
19
+
20
+
21
+ どうやら、以下のコードで最初にdataが取得できていないのが問題?
22
+
23
+ ```Javascript
24
+
25
+ async asyncData () {
26
+
27
+ let data
28
+
29
+ await axios.get('/URL')
30
+
31
+ .then(function (response) {
32
+
33
+ return {
34
+
35
+ data: data
36
+
37
+ }
38
+
39
+ })
40
+
41
+ .catch(function (error) {
42
+
43
+ console.log(error)
44
+
45
+ return {
46
+
47
+ data: null
48
+
49
+ }
50
+
51
+ })
52
+
53
+ ```
18
54
 
19
55
 
20
56
 

3

追記

2018/03/24 09:56

投稿

massy7
massy7

スコア45

test CHANGED
File without changes
test CHANGED
@@ -21,6 +21,10 @@
21
21
  localhost:3000/nothing (存在しないページ)にアクセスした際に出る404ページに設置されている`nuxt-link`では正常に`<nuxt-link class="button" to="/">Index</nuxt-link>`に飛ぶが、
22
22
 
23
23
  localhost:3000にURLでアクセスした際に出る404ページに設置されている`nuxt-link`では飛べない(htmlのaタグは同じ。SPAがロードされていない?)
24
+
25
+
26
+
27
+ connect ECONNREFUSED ::1:3000が発生する
24
28
 
25
29
 
26
30
 

2

更新

2018/03/15 02:08

投稿

massy7
massy7

スコア45

test CHANGED
File without changes
test CHANGED
File without changes

1

追記

2018/03/11 09:46

投稿

massy7
massy7

スコア45

test CHANGED
File without changes
test CHANGED
@@ -54,4 +54,4 @@
54
54
 
55
55
 
56
56
 
57
- 見落としあるかと思うのですが、ご教授願います。
57
+ Expressのサーバ設定等、見落としあるかと思うのですが、ご教授願います。