IndexThreeAds.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <view class="div three-ads" v-if="items && items.length">
  3. <view class="div ad-1" v-if="items[0]" :style="'height:'+(windowWidth/2*260/320)+'px'">
  4. <image mode="aspectFit" class="img" :src="items[0].adv_code" @click="goAdUrl(items[0])"/>
  5. </view>
  6. <view class="div fr">
  7. <view class="div ad-2" v-if="items[1]" :style="'height:'+(windowWidth/2*260/320/2)+'px'">
  8. <image mode="aspectFit" class="img" :src="items[1].adv_code" @click="goAdUrl(items[1])"/>
  9. </view>
  10. <view class="div ad-3" v-if="items[2]" :style="'height:'+(windowWidth/2*260/320/2)+'px'">
  11. <image mode="aspectFit" class="img" :src="items[2].adv_code" @click="goAdUrl(items[2])"/>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. import { urlencode } from '@/util/common'
  18. export default {
  19. name: 'IndexThreeAds',
  20. data () {
  21. return {
  22. }
  23. },
  24. props: ['items'],
  25. computed: {
  26. windowWidth: function () {
  27. const res = uni.getSystemInfoSync()
  28. var width=res.windowWidth
  29. return width
  30. },
  31. },
  32. methods: {
  33. goAdUrl (item) {
  34. uni.navigateTo({url:item.adv_typedate})
  35. }
  36. }
  37. }
  38. </script>
  39. <style scoped lang="scss">
  40. .three-ads{display: flex;background: #fff;padding-left:$pageSpace;padding-right:$pageSpace;padding-bottom:$modelSpace}
  41. .three-ads .img{width:100%;border-radius: .4rem}
  42. .three-ads .ad-1{flex:1;margin-right: .2rem}
  43. .three-ads .fr{flex:1;display: flex;flex-direction: column;justify-content: space-between;margin-left:.2rem;}
  44. </style>