activity-detail.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <view class="detail">
  3. <template v-if="type === 'video'">
  4. <video :src="videoUrl" :title="title"></video>
  5. </template>
  6. <template v-else>
  7. <image :src="adsImage" mode="widthFix" show-menu-by-longpress></image>
  8. </template>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. data() {
  14. return {
  15. adsImage: '',
  16. videoUrl: '',
  17. title: '',
  18. type: ''
  19. }
  20. },
  21. onLoad(option) {
  22. this.title = option.title
  23. this.type = option.type || 'image'
  24. if (this.type === 'video') {
  25. this.videoUrl = option.videoUrl
  26. } else {
  27. this.adsImage = option.adsImage
  28. }
  29. if (this.title && this.title !== 'null') {
  30. uni.setNavigationBarTitle({ title: this.title })
  31. }
  32. }
  33. }
  34. </script>
  35. <style lang="scss">
  36. .detail {
  37. width: 100%;
  38. height: auto;
  39. image {
  40. width: 100%;
  41. height: auto;
  42. }
  43. video {
  44. width: 100vw;
  45. background: #999;
  46. }
  47. }
  48. </style>