index.js 485 B

12345678910111213141516171819202122232425262728293031
  1. var app = new Vue({
  2. el: "#app",
  3. data: {
  4. categoryName: "",
  5. pages: []
  6. },
  7. mounted: function() {
  8. this.categoryName = $("#categoryName").val();
  9. this.getCategoryPages();
  10. },
  11. methods: {
  12. getCategoryPages: function() {
  13. let data = {
  14. category: this.categoryName
  15. };
  16. $.ajax({
  17. url: "/api/blob/",
  18. method: "GET",
  19. data: data,
  20. success: function(data) {
  21. app.pages = data.categories[0].pages;
  22. },
  23. error: toast.defaultAjaxError
  24. });
  25. }
  26. }
  27. });