<template>
	<view>
		<image v-if="isIcon" style="border-radius: 60rpx;" :class="[mymode=='widthFix'?'imageW':'imagev']"  :src="showdefault==1?'/static/logo.png':baseUrl+comUrl" :mode="mymode" @error="imageError" @click="myimageclick"></image>
		<image v-if="!isIcon" :class="[mymode=='widthFix'?'imageW':'imagev']"  :src="showdefault==1?'/static/logo.png':baseUrl+comUrl" :mode="mymode" @error="imageError" @click="myimageclick"></image>
	</view>
</template>

<script>
	export default {
		name:"myImage",
		props:{
			mysrc: '',
			mymode:'',
			isIcon:false
		},
		data() {
			return {
				defaultImage:'/static/logo.png',
				baseUrl:getApp().globalData.getUrl(1),
				showdefault:0,
				comUrl:this.mysrc
			};
		},
		watch: {
			mysrc(val){
				this.showdefault=0;
				this.comUrl = this.mysrc;
				// console.log(this.baseUrl);
			}
		},
		methods:{
			imageError(){
				//this.comUrl = this.defaultImage;//morentup
				this.showdefault=1;
			},
			myimageclick(comUrl){
				console.log(this.baseUrl+this.comUrl);
				this.$emit('Emyimageclick',comUrl);
			},
		},
	}
</script>

<style>
	.imageW{
		margin: 0rpx;
		width:100%;
	}
	.imageH{
		margin: 0rpx;
		height:100%;
	}
	.imagev{
		width:100%;
		height:100%;
	}
</style>
