
<template>
	<div @click="showPhoto" style="margin-top:20px">
		<img style="width:40px" :src="src" alt />
		<Modal v-model="show" title="图片" footer-hide :width="432">
			<img style="width:400px" :src="photoSrc" alt />
		</Modal>
	</div>
</template>

<script>
export default {
	name: 'image-cell',
	data() {
		return {
			src: null,
			show: false,
			photoSrc: null
		};
	},
	mounted() {
		let column = this.params.colDef;
		if (this.params.value) {
			this.src = this.params.value
		}
	},
	computed: {

	},
	methods: {
		showPhoto() {
			const srcKey = this.params.colDef.cellRendererParams.photoPath ? this.params.colDef.cellRendererParams.photoPath : 'photoPath'
			let src = this.params.data[srcKey];
			if (src) {
				this.show = true;
				this.photoSrc = src;
			}
		}
	}
};
</script>