index.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. define([
  2. 'text!./index.html',
  3. 'swiper'
  4. ], function(html, Swiper) {
  5. return {
  6. props: {
  7. recommend: {
  8. type: Object,
  9. default: function () {
  10. return {};
  11. }
  12. },
  13. rankList: {
  14. type: Array,
  15. default: function () {
  16. return [];
  17. }
  18. },
  19. goodList: {
  20. type: Array,
  21. default: function () {
  22. return [];
  23. }
  24. },
  25. newList: {
  26. type: Array,
  27. default: function () {
  28. return [];
  29. }
  30. }
  31. },
  32. watch: {
  33. goodList: function () {
  34. var vm = this;
  35. this.$nextTick(function () {
  36. this.swiper = new Swiper('.swiper-container', {
  37. slidesPerView: 'auto',
  38. spaceBetween: 10,
  39. centeredSlides: true,
  40. initialSlide: 1,
  41. autoplay: true,
  42. loop: true,
  43. // loopedSlides: 4,
  44. observer: true,
  45. observeParents: true,
  46. observeSlideChildren: true
  47. });
  48. });
  49. }
  50. },
  51. mounted: function () {
  52. },
  53. methods: {
  54. },
  55. template: html
  56. };
  57. });