test.js 898 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. var app = new Vue({
  2. el: '#app',
  3. data: {
  4. assets: {
  5. showcase: [],
  6. highest_rated: [],
  7. new_additions: [],
  8. recently_updated: []
  9. }
  10. },
  11. components: {
  12. 'carousel-3d': Carousel3d.Carousel3d,
  13. 'slide': Carousel3d.Slide
  14. },
  15. mounted: function() {
  16. this.getTopAssets();
  17. },
  18. methods: {
  19. getTopAssets: function() {
  20. $.ajax({
  21. url: "/api/page/top/",
  22. method: "GET",
  23. success: data => {
  24. app.assets.showcase = data.showcase;
  25. app.assets.highest_rated = data.highest_rated;
  26. app.assets.new_additions = data.new_additions;
  27. app.assets.recently_updated = data.recently_updated;
  28. },
  29. error: function(xhr, status, error) {
  30. app.displayToast("Error " + xhr.status + ": " + xhr.responseJSON.message);
  31. },
  32. complete: function(jqXHR, textStatus) {
  33. $("#pageLoader").removeClass("active");
  34. }
  35. });
  36. },
  37. }
  38. })