| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <template>
- <view :class="backgrS==1?'':'imageBGV'" :style="{width:width+'rpx',height:height+'rpx',borderRadius:bradius+'rpx'}">
- <image :style="{width:width+'rpx',height:height+'rpx',borderRadius:bradius+'rpx'}" :src="compleurl(comUrl)" :mode="mymode" @error="imageError" @click="myimageclick"></image>
- </view>
- </template>
- <script>
- export default {
- name:"netImage",
- props:{
- mysrc: '',
- mymode:'',
- width:0,
- height:0,
- bradius:0,
- backgrS:0,
- },
- data() {
- return {
- defaultImage:'/static/logo.png',
- baseUrl:'https://backend.awayqtw.com/prod-api',
- showdefault:0,
- comUrl:this.mysrc
- };
- },
- watch: {
- mysrc(val){
- this.showdefault=0;
- this.comUrl = this.mysrc
- //console.log('watch-------------')
- //console.log(this.comUrl);
- }
- },
- methods:{
- imageError(){
- this.comUrl ='';// this.defaultImage;//morentup
- //console.log('imageError---------------')
- //console.log(this.baseUrl+this.comUrl)
- this.showdefault=1;
- },
- myimageclick(){
- this.$emit('Emyimageclick',this.comUrl);
- },
- compleurl(url){
- //console.log('------compleurl',url)
- if(!url){
- return '';
- }
- if(url.length<8){
- return '';
- }
- var http= url.substring(0,8);
- if(http==='https://'){
- return url;
- }
- else if(http==='/static/'){
- return url;
- }
- else{
- //console.log(this.baseUrl+url);
- return (this.baseUrl+url);
- }
- }
- },
- }
- </script>
- <style>
- .imageBGV{
- background-color:floralwhite;
- border: 1rpx solid lightgray;
- }
- </style>
|