1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <template>
- <view class="detail">
- <template v-if="type === 'video'">
- <video :src="videoUrl" :title="title"></video>
- </template>
- <template v-else>
- <image :src="adsImage" mode="widthFix" show-menu-by-longpress></image>
- </template>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- adsImage: '',
- videoUrl: '',
- title: '',
- type: ''
- }
- },
- onLoad(option) {
- this.title = option.title
- this.type = option.type || 'image'
- if (this.type === 'video') {
- this.videoUrl = option.videoUrl
- } else {
- this.adsImage = option.adsImage
- }
- if (this.title && this.title !== 'null') {
- uni.setNavigationBarTitle({ title: this.title })
- }
- }
- }
- </script>
- <style lang="scss">
- .detail {
- width: 100%;
- height: auto;
- image {
- width: 100%;
- height: auto;
- }
- video {
- width: 100vw;
- background: #999;
- }
- }
- </style>
|