Skip to content

Instantly share code, notes, and snippets.

@artrayd
Last active July 2, 2020 08:56
Show Gist options
  • Save artrayd/18ff6c6e91b63dce969d5752767cb115 to your computer and use it in GitHub Desktop.
Save artrayd/18ff6c6e91b63dce969d5752767cb115 to your computer and use it in GitHub Desktop.
Importing array from local JSON file to Vue
// Importing array from local JSON file
import json from "@/assets/letters/greek-alphabet.json";
export default {
name: "Alphabet",
data: function() {
return {
letters: json.letters, // passing array data into Vue
};
},
mounted: function() {
// Checking if everything works, delete this right after you see that everything works
console.log(this.letters);
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment