view.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <gracePage :customHeader="false">
  3. <view class="container" slot="gBody">
  4. <swiper class="swiper" @change="change" :circular="swiper.circular">
  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. swiper : {
  23. index : 0,
  24. circular : false,
  25. },
  26. fetch: {
  27. items : []
  28. },
  29. control : {}
  30. }
  31. },
  32. onLoad(option) {
  33. this.id = option.id;
  34. this.getData();
  35. },
  36. // 下拉刷新
  37. onPullDownRefresh: function() {
  38. this.getData();
  39. },
  40. // 重新加载
  41. onPullDownRefresh: function() {
  42. this.getData();
  43. },
  44. methods:{
  45. change : function(e) {
  46. this.swiper.index = e.detail.current;
  47. if (this.control) {
  48. var i = 0;
  49. for (i in this.control) {
  50. if (this.control[i].load) {
  51. console.info(i);
  52. if (this.swiper.index == i) {
  53. console.info('start');
  54. this.control[i].start();
  55. } else {
  56. this.control[i].stop();
  57. }
  58. }
  59. }
  60. }
  61. },
  62. view : function() {
  63. this.Dever.location('dream/view?id=1');
  64. },
  65. getData : function() {
  66. this.Dever.get(this, 'app/collection/?l=api.getContent', {id:this.id});
  67. }
  68. },
  69. components:{
  70. gracePage,dream
  71. }
  72. }
  73. </script>
  74. <style>
  75. .container {
  76. position: absolute;
  77. height: 100%;
  78. width: 100%;
  79. left: 0;
  80. top: 0;
  81. }
  82. .swiper {
  83. width: 750rpx;
  84. height: 100%;
  85. }
  86. swiper-item>view{
  87. height: 100%;
  88. }
  89. swiper-item image{
  90. width: 750rpx;
  91. height: 100%;
  92. }
  93. .scroll-height {
  94. height:100%;
  95. }
  96. </style>