index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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" :key="k">
  6. <view class="default">
  7. <image :src="v.pic" mode="widthFix"></image>
  8. </view>
  9. </swiper-item>
  10. </swiper>
  11. <view class="btn">
  12. <view class='dots'>
  13. <text :class="swiper.index == k ? 'cur' : ''" v-for="(v, k) in fetch.items" :key="k"></text>
  14. </view>
  15. <view class="grace-flex-center">
  16. <button @click="view" type="default" class="grace-button button" :style="fetch.button.read.style">{{fetch.button.read.name}}</button>
  17. </view>
  18. </view>
  19. </view>
  20. </gracePage>
  21. </template>
  22. <script>
  23. export default{
  24. data() {
  25. return {
  26. swiper : {
  27. index : 0,
  28. circular : true,
  29. },
  30. fetch: {
  31. items : [
  32. {
  33. pic : 'https://7.jstyle.cn/1/2020/04/25/a69fdba6a0cba49d46cc07b8e269b546.jpg',
  34. url : '',
  35. title:"测试标题 001",
  36. opentype : 'navigate'
  37. },
  38. {
  39. pic : 'https://7.jstyle.cn/1/2020/04/25/224697c330eca688097b4d0e4189709e.jpg',
  40. url : '',
  41. title:"测试标题 02",
  42. opentype : 'navigate'
  43. },
  44. ],
  45. button : {
  46. read : {
  47. name : '阅读',
  48. style : 'background: linear-gradient(to right, #FF0066,#CA00FF) !important;color:#ffffff'
  49. }
  50. }
  51. }
  52. }
  53. },
  54. methods:{
  55. change : function(e) {
  56. this.swiper.index = e.detail.current;
  57. },
  58. view : function() {
  59. this.Dever.location('dream/view?id=1');
  60. }
  61. },
  62. }
  63. </script>
  64. <style>
  65. .container {
  66. position: absolute;
  67. height: 100%;
  68. width: 100%;
  69. left: 0;
  70. top: 0;
  71. }
  72. .swiper {
  73. width: 750rpx;
  74. height: 100%;
  75. }
  76. swiper-item>view{
  77. height: 100%;
  78. }
  79. swiper-item image{
  80. width: 750rpx;
  81. height: 100%;
  82. }
  83. .btn {
  84. position: absolute;
  85. bottom: 20rpx;
  86. left: 60rpx;
  87. right: 60rpx;
  88. }
  89. .btn .dots{
  90. display: flex;
  91. justify-content: center;
  92. margin-bottom: -88rpx;
  93. }
  94. .btn .dots text{
  95. display: block;
  96. width: 16rpx;
  97. height: 8rpx;
  98. background: rgba(255, 255, 255, 0.5);
  99. border-radius: 8rpx;
  100. margin: 0 5rpx;
  101. }
  102. .btn .dots text.cur{
  103. background-color: rgba(255, 255, 255, 1);
  104. /*background: red;*/
  105. }
  106. .button{
  107. margin-top: 8rpx;
  108. height:60rpx;
  109. width:200rpx;
  110. text-align: center;
  111. line-height: 28px;
  112. border-radius: 0;
  113. }
  114. </style>