Commit d14e396f authored by Jenny's avatar Jenny

feat: 远程图片

parent 671f2342
<template> <template>
<view class="remoteView"> <view class="remoteView">
<NormalTitle :elementInfo="elementInfo"></NormalTitle> <NormalTitle :elementInfo="elementInfo"></NormalTitle>
<u-image <u-image
class="remoteImage" class="remoteImage"
:src="imageUrl" :src="imageUrl"
width="100%" width="100%"
:height="imageHeight" height="100%"
mode="aspectFit"
></u-image> ></u-image>
</view> </view>
</template> </template>
...@@ -18,37 +19,29 @@ ...@@ -18,37 +19,29 @@
mixins: [echartElementData], mixins: [echartElementData],
data() { data() {
return { return {
imageUrl:"", imageUrl:""
windowWidth: 0, //屏幕宽度
imageHeight:0 //图片高度
}; };
}, },
methods:{ methods:{
initChart() { initChart() {
uni.getSystemInfo({
success: res=> {
this.windowWidth = res.windowWidth;
this.imageHeight = (this.windowWidth*this.elementInfo.height)/this.elementInfo.width;
}
});
this.$nextTick(() => { this.$nextTick(() => {
this.imageUrl = this.elementData.dataList.imageUrl this.imageUrl = this.elementData.dataList.imageUrl
}) })
}, }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.remoteView { .remoteView {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100%; width: 100%;
overflow: hidden; height: 100%;
} overflow: hidden;
.remoteImage { }
object-fit: contain; .remoteImage {
} width: 100%;
height: 100%;
}
</style> </style>
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