Commit dadd89e9 authored by chris.yang's avatar chris.yang

feat:新增普通图片

parent 93115452
<template>
<view class="normal-image">
<BasicText :elementInfo="elementInfo.option.title"></BasicText>
<u-empty
v-if="!elementInfo.option.images.list.length"></u-empty>
<u-image
v-if="elementInfo.option.images.list.length === 1"
width="100%"
:height="imageHeight"
:src="elementInfo.option.images.list[0].url">
</u-image>
<u-swiper
v-if="elementInfo.option.images.list.length > 1"
mode="dot"
:autoplay="elementInfo.optison.images.autoplay"
:interval="elementInfo.option.images.autoplaySpeed * 1000"
:indicator="elementInfo.option.images.dots"
:list="elementInfo.option.images.list"
width="100%"
:height="imageHeight"
name="url">
</u-swiper>
</view>
</template>
<script>
export default {
name: "NormalImage",
props: {
elementInfo: {
type: Object,
required: true
}
},
data() {
return {
windowWidth: 0, //屏幕宽度
imageHeight:0 //图片高度
};
},
mounted() {
uni.getSystemInfo({
success: res=> {
this.windowWidth = res.windowWidth;
this.imageHeight = (this.windowWidth*this.elementInfo.height)/this.elementInfo.width;
}
});
},
onLoad() {
}
}
</script>
<style lang="less" scoped>
.normal-image {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
image {
max-width: 100%;
max-height: 100%;
object-fit: contain;
}
}
</style>
......@@ -32,6 +32,8 @@
<BasicText v-if="element.type == 'BasicText'" :elementInfo="element"></BasicText>
<!-- 真实时间 -->
<RealTime v-if="element.type == 'RealTime'" :elementInfo="element"></RealTime>
<!-- 普通图片 -->
<NormalImage v-if="element.type == 'NormalImage'" :elementInfo="element"></NormalImage>
</view>
</view>
</template>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment