Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var dataURL = 'https://jsonplaceholder.typicode.com/posts';
- var App = new Vue({
- el: '#app',
- data: {
- posts: [] // initialize empty array
- },
- mounted() { // when the Vue app is booted up, this is run automatically.
- var self = this // create a closure to access component in the callback below
- $.getJSON(dataURL, function(data) {
- self.posts = data;
- });
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement