view.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <gracePage :customHeader="false">
  3. <view class="container" slot="gBody">
  4. <swiper class="swiper" @change="change" :circular="swiper.circular" :current="index">
  5. <swiper-item v-for="(v, k) in fetch.items" v-if="v.data" :key="k" >
  6. <scroll-view scroll-y="true" scroll-x="true" class="scroll-height">
  7. <dream ref="dream" :index="k" :item="v" :control="control" class="item"></dream>
  8. </scroll-view>
  9. </swiper-item>
  10. </swiper>
  11. </view>
  12. </gracePage>
  13. </template>
  14. <script>
  15. import gracePage from "@/lib/graceUI/components/gracePage.vue";
  16. import dream from "@/pages/dream/view/dream.vue";
  17. var graceRichText = require("@/lib/graceUI/jsTools/richText.js");
  18. export default{
  19. data() {
  20. return {
  21. id : 1,
  22. page_id : 1,
  23. index : 0,
  24. swiper : {
  25. index : 0,
  26. circular : false,
  27. },
  28. fetch: {
  29. items : []
  30. },
  31. control : {}
  32. }
  33. },
  34. onLoad(option) {
  35. this.id = option.id;
  36. this.page_id = option.page_id;
  37. this.index = option.index;
  38. this.getData();
  39. },
  40. // 下拉刷新
  41. onPullDownRefresh: function() {
  42. this.getData();
  43. },
  44. // 重新加载
  45. onPullDownRefresh: function() {
  46. this.getData();
  47. },
  48. methods:{
  49. change : function(e) {
  50. this.swiper.index = e.detail.current;
  51. if (this.control) {
  52. var i = 0;
  53. for (i in this.control) {
  54. if (this.control[i].load) {
  55. console.info(i);
  56. if (this.swiper.index == i) {
  57. console.info('start');
  58. this.control[i].start();
  59. } else {
  60. this.control[i].stop();
  61. }
  62. }
  63. }
  64. }
  65. if (this.swiper.index == this.fetch.items.length - 1) {
  66. this.$refs.dream[this.swiper.index].setSelectShow(true);
  67. }
  68. },
  69. view : function() {
  70. this.Dever.location('dream/view?id=1');
  71. },
  72. getData : function() {
  73. this.Dever.get(this, 'app/collection/?l=api.getContent', {id:this.id, page_id:this.page_id});
  74. }
  75. },
  76. components:{
  77. gracePage,dream
  78. }
  79. }
  80. </script>
  81. <style>
  82. .container {
  83. position: absolute;
  84. height: 100%;
  85. width: 100%;
  86. left: 0;
  87. top: 0;
  88. }
  89. .swiper {
  90. width: 750rpx;
  91. height: 100%;
  92. }
  93. swiper-item>view{
  94. height: 100%;
  95. }
  96. swiper-item image{
  97. width: 750rpx;
  98. height: 100%;
  99. }
  100. .scroll-height {
  101. height:100%;
  102. }
  103. </style>