Created
June 17, 2020 19:57
-
-
Save KenoLeon/220511303766c0a1dd0b67b9ad027e94 to your computer and use it in GitHub Desktop.
Vue json call from App parent
This file contains hidden or 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
| <script> | |
| import jQuery from 'jquery'; | |
| let $ = jQuery; | |
| export default { | |
| name: 'App', | |
| components: { | |
| tableComponent, | |
| chartComponent | |
| }, | |
| created : function(){ | |
| var _this = this; | |
| // Using Jquery, you could use something else, note that your response is going to be different, | |
| // here it returns a chartLeaderboard and tableLeaderboard but yours is probably different | |
| // If you want to further modify your response this is a good place to do so. | |
| // | |
| $.getJSON('https://YOUR_API_URL', function (data) { | |
| _this.chartData = data.charLeaderboard | |
| _this.tableData = data.tableLeaderboard | |
| }) | |
| }, | |
| data() { | |
| return { | |
| chartData = [] | |
| tableData = [] | |
| } | |
| } | |
| } | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment