更新
This commit is contained in:
1 parent
f37f31627e
commit
7494f9f790
5 files changed
+137
-3
No files matched your search
@@ -0,0 +1,60 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="avatar-icon"></view>
|
||||
<view class="avatar-image">
|
||||
<image class="image-style" mode="aspectFill" :src="showImage" @error="imageError"></image>
|
||||
</view>
|
||||
<text class="avatar-text">{{name}}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
image: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
defaultImage: require('@/static/image/errImage.jpeg'),
|
||||
imageErrorStatus: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
showImage() {
|
||||
if (this.imageErrorStatus) {
|
||||
returnthis.defaultImage
|
||||
} else {
|
||||
return this.image || this.defaultImage
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
imageError() {
|
||||
this.imageErrorStatus = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.avatar-icon {}
|
||||
|
||||
.avatar-image {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
}
|
||||
|
||||
.image-style {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.avatar-text {}
|
||||
</style>
|
||||
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="top-block">
|
||||
<view class="mike-site-block">
|
||||
<view class="mike-site-top">
|
||||
<avatar></avatar>
|
||||
</view>
|
||||
<view class="mike-site-main">
|
||||
<avatar></avatar>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom-block">
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import avatar from './avatar.vue'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
Reference in new issue
Block a user