vue.jsとvuexで作成しています。
assets内にjs/color.jsonというデータを作成しているのですが、
../assets/js/color.json
からデータが取得できません。
詳しくは、
index.html
に
var getColorURL = "../assets/js/color.json"
と記述して、
store内でmodulesを作成しその中のactionで`getColorURL`を使いaxiosでデータを取得しようとしています。
axios.get(getColorURL) .then(function (response) { context.commit('colorData', response.data) }).catch(function (error) { alert(error) })
https://teratail.com/questions/115098
の記事も読んでみて試したのですが、ダメでした。
ご回答お願いいたします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/09/19 05:14