質問編集履歴

2

例の追加

2018/07/30 02:09

投稿

TaikiNamioka
TaikiNamioka

スコア24

test CHANGED
@@ -1 +1 @@
1
- vue asset内のjsonファイルを読み込めず404になる。
1
+ vue asset内のjsonファイルを読み込めず404になる。
test CHANGED
@@ -16,6 +16,22 @@
16
16
 
17
17
  store内でmodulesを作成しその中のactionで`getColorURL`を使いaxiosでデータを取得しようとしています。
18
18
 
19
+ ```
20
+
21
+ axios.get(getColorURL)
22
+
23
+ .then(function (response) {
24
+
25
+ context.commit('colorData', response.data)
26
+
27
+ }).catch(function (error) {
28
+
29
+ alert(error)
30
+
31
+ })
32
+
33
+ ```
34
+
19
35
 
20
36
 
21
37
  [https://teratail.com/questions/115098](https://teratail.com/questions/115098)

1

みやすく修正

2018/07/30 02:09

投稿

TaikiNamioka
TaikiNamioka

スコア24

test CHANGED
File without changes
test CHANGED
@@ -4,13 +4,13 @@
4
4
 
5
5
  assets内にjs/color.jsonというデータを作成しているのですが、
6
6
 
7
- ../assets/js/color.jsonからデータが取得できません。
7
+ `../assets/js/color.json`からデータが取得できません。
8
8
 
9
9
 
10
10
 
11
11
  詳しくは、
12
12
 
13
- index.htmlに
13
+ `index.html`
14
14
 
15
15
  `var getColorURL = "../assets/js/color.json"`と記述して、
16
16
 
@@ -18,6 +18,8 @@
18
18
 
19
19
 
20
20
 
21
- https://teratail.com/questions/115098の記事も読んでみて試したのですが、ダメでした。
21
+ [https://teratail.com/questions/115098](https://teratail.com/questions/115098)
22
+
23
+ の記事も読んでみて試したのですが、ダメでした。
22
24
 
23
25
  ご回答お願いいたします。