Last active
July 2, 2020 08:56
-
-
Save artrayd/18ff6c6e91b63dce969d5752767cb115 to your computer and use it in GitHub Desktop.
Importing array from local JSON file to Vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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