質問編集履歴
5
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,11 +30,7 @@
|
|
30
30
|
|
31
31
|
.then(function (response) {
|
32
32
|
|
33
|
-
return {
|
34
|
-
|
35
|
-
|
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
|
-
|
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
追記
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
追記
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
更新
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -54,4 +54,4 @@
|
|
54
54
|
|
55
55
|
|
56
56
|
|
57
|
-
見落とし
|
57
|
+
Expressのサーバ設定等、見落としがあるかと思うのですが、ご教授願います。
|