index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <!-- <view class="content">-->
  3. <!-- <image class="logo" src="/static/logo.png"></image>-->
  4. <!-- <view class="text-area">-->
  5. <!-- <text class="title">{{title}}</text>-->
  6. <!-- </view>-->
  7. <!-- <button @click="test">测试按钮</button>-->
  8. <!-- <van-button type="primary">van的button</van-button>-->
  9. <!-- </view>-->
  10. <view class="content">
  11. <van-search
  12. :value="value"
  13. placeholder="请输入搜索关键词"
  14. @search="onSearch"
  15. @cancel="onCancel"
  16. @change="onChange"
  17. @click="gotoSearch"
  18. />
  19. <!-- show-action -->
  20. <!-- <scroll-view scroll-x="true">
  21. <view>1</view>
  22. </scroll-view> -->
  23. <!-- <view class="uni-margin-wrap">
  24. <swiper :autoplay="true">
  25. <swiper-item item-id="A">
  26. <view class="swiper-item uni-bg-red"><text class="swiper-item-Text">A</text></view>
  27. </swiper-item>
  28. <swiper-item item-id="B">
  29. <view class="swiper-item uni-bg-green"><text class="swiper-item-Text">B</text></view>
  30. </swiper-item>
  31. <swiper-item item-id="C">
  32. <view class="swiper-item uni-bg-blue"><text class="swiper-item-Text">C</text></view>
  33. </swiper-item>
  34. </swiper>
  35. </view> -->
  36. <!-- 轮播图区域 -->
  37. <swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000" :circular="true">
  38. <swiper-item v-for="(item,i) in swiperList" :key="i">
  39. <!-- 123 -->
  40. <navigator class="swiper-item" :url="'/subpkg/goods_detail/goods_detail?goods_id='+item.goods_id">
  41. <!-- <navigator class="swiper-item"> -->
  42. <img :src="item.image_src" alt="">
  43. </navigator>
  44. </swiper-item>
  45. </swiper>
  46. <!-- <image class="logo" src="/static/logo.png"></image>
  47. <view class="text-area">
  48. <text class="title">{{title}}</text>
  49. </view> -->
  50. <!-- 123 -->
  51. <my-grid></my-grid>
  52. </view>
  53. </template>
  54. <script >
  55. console.log(uni.$http)
  56. export default {
  57. data() {
  58. return {
  59. title: 'Hello',
  60. value:"",
  61. //这是轮播图的数据列表
  62. swiperList:[{goods_id: 123,
  63. image_src: "../../static/logo.png",
  64. goods_name: "string"},{goods_id: 124,
  65. image_src: "../../static/logo.png",
  66. goods_name: "string"},{goods_id: 125,
  67. image_src: "../../static/logo.png",
  68. goods_name: "string"}],
  69. }
  70. },
  71. onLoad() {
  72. },
  73. methods: {
  74. test() {
  75. console.log(1, "test");
  76. },
  77. onSearch() {
  78. console.log('查询了');
  79. },
  80. onCancel(){
  81. console.log('取消了');
  82. },
  83. gotoSearch(){
  84. console.log('去了');
  85. uni.navigateTo({
  86. url:"/subpkg/search/search"
  87. })
  88. },
  89. onChange(){
  90. console.log('修改了');
  91. }
  92. },
  93. }
  94. </script>
  95. <style lang="scss">
  96. swiper{
  97. height: 330rpx;
  98. width: 95%;
  99. .swiper-item,
  100. image{
  101. width: 100%;
  102. height: 100%;
  103. }
  104. }
  105. .content {
  106. display: flex;
  107. flex-direction: column;
  108. align-items: center;
  109. justify-content: center;
  110. }
  111. .logo {
  112. height: 200rpx;
  113. width: 200rpx;
  114. margin-top: 200rpx;
  115. margin-left: auto;
  116. margin-right: auto;
  117. margin-bottom: 50rpx;
  118. }
  119. .text-area {
  120. display: flex;
  121. justify-content: center;
  122. }
  123. .title {
  124. font-size: 36rpx;
  125. color: #8f8f94;
  126. }
  127. </style>