Commit 7bd2aa5c authored by Jenny's avatar Jenny

feat: 柱状图弹框 - 图片点击预览

parent 1601aefe
...@@ -73,7 +73,8 @@ export default { ...@@ -73,7 +73,8 @@ export default {
} }
chart.setOption(that.ec.option) chart.setOption(that.ec.option)
chart.on('click', event => { chart.on('click', event => {
const { preview, images, popup, data } = that.elementData.dataList const { preview, images, popup, data, customRender } =
that.elementData.dataList
var urls = [] var urls = []
var caches = uni.getStorageSync('cacheImages') var caches = uni.getStorageSync('cacheImages')
images && images &&
...@@ -93,7 +94,8 @@ export default { ...@@ -93,7 +94,8 @@ export default {
} else if (popup) { } else if (popup) {
uni.$emit('showBarDetail', { uni.$emit('showBarDetail', {
popupShow: true, popupShow: true,
popupData: data[event.dataIndex] popupData: data[event.dataIndex],
customRender
}) })
} else { } else {
that.handleEchartsClick(event) that.handleEchartsClick(event)
......
...@@ -10,7 +10,17 @@ ...@@ -10,7 +10,17 @@
<view class="slot-content"> <view class="slot-content">
<view v-for="(val, key) in popupData" class="data-view"> <view v-for="(val, key) in popupData" class="data-view">
<view class="data-key ellipsis">{{ key }}</view> <view class="data-key ellipsis">{{ key }}</view>
<view class="data-val ellipsis">{{ val }}</view> <template v-if="customRender[key] === 'picture'">
<u-image
:height="100"
mode="aspectFit"
:src="val"
crossOrigin="anonymous"
style="width: 100%"
@click="seeImage(val)"
></u-image>
</template>
<view v-else class="data-val ellipsis">{{ val }}</view>
</view> </view>
</view> </view>
</u-modal> </u-modal>
...@@ -30,15 +40,24 @@ export default { ...@@ -30,15 +40,24 @@ export default {
popupShow: { popupShow: {
type: Boolean, type: Boolean,
default: false default: false
},
customRender: {
type: Object,
default: () => {}
} }
}, },
methods: { methods: {
close() { close() {
console.log(1)
uni.$emit('showBarDetail', { uni.$emit('showBarDetail', {
popupShow: false, popupShow: false,
popupData: {} popupData: {}
}) })
},
seeImage(url) {
uni.previewImage({
current: 0,
urls: [url]
})
} }
} }
} }
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
style="position: relative;z-index: 99999;" style="position: relative;z-index: 99999;"
:popupShow="popupShow" :popupShow="popupShow"
:popupData="popupData" :popupData="popupData"
:customRender="customRender"
></ModelData> ></ModelData>
</view> </view>
</template> </template>
...@@ -78,7 +79,8 @@ ...@@ -78,7 +79,8 @@
stickyTables: [], // 设置了吸顶的table stickyTables: [], // 设置了吸顶的table
horizontalBarHeight: 0, horizontalBarHeight: 0,
popupShow: false, popupShow: false,
popupData: {} popupData: {},
customRender: {}
} }
}, },
computed: { computed: {
...@@ -154,9 +156,10 @@ ...@@ -154,9 +156,10 @@
that.horizontalBarHeight = height that.horizontalBarHeight = height
}) })
uni.$on('showBarDetail', data => { uni.$on('showBarDetail', data => {
const { popupShow, popupData } = data const { popupShow, popupData, customRender } = data
that.popupShow = popupShow that.popupShow = popupShow
that.popupData = popupData that.popupData = popupData
that.customRender = customRender
}) })
}, },
onHide() { onHide() {
......
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