Advertisement
Guest User

Untitled

a guest
Jan 11th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. data() {
  2. return {
  3. news: [],
  4. index: 0
  5. };
  6. },
  7. created() {
  8. setInterval(() => {
  9. this.index++;
  10. let n={};
  11. n.title="News "+this.index;
  12. n.url="https://myapi.co/news/"+this.index;
  13. this.news.push(n)
  14.  
  15. }, 4000);
  16. },
  17. mounted() {
  18. axios.get('https://myapi.co/news/')
  19. .then(response => {
  20. this.news = response.data.data
  21. });
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement