feat: app添加默认头像

This commit is contained in:
陈淳
2023-10-18 12:20:43 +08:00
parent 181e2b21bb
commit a9f2a0c2ac
2 changed files with 23 additions and 23 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -1,35 +1,35 @@
<template>
<van-image
round
:width="width"
:height="height"
:src="url+(src??'0')"
/>
<van-image round :width="width" :height="height" :src="getUrl()" />
</template>
<script setup lang="ts">
import { type } from 'os';
import { ref } from 'vue'
const props= defineProps({
src: {type:String,default:'null',required:false},
width:{type:String,default:'3rem',required:false},
height:{type:String,default:'3rem',required:false}
})
const props = defineProps({
src: { type: String, default: "null", required: false },
width: { type: String, default: "3rem", required: false },
height: { type: String, default: "3rem", required: false },
});
const url = `${import.meta.env.VITE_APP_BASE_API}/file/`;
const getUrl = () => {
const src = props.src;
if (src === null || typeof src === "undefined" || src.trim() === "") {
return "/src/assets/icon.jpg";
// 字符串为 null、未定义或为空字符串
} else {
return url + "src";
}
};
</script>
<style scoped>
.col-body
{
text-align: center;
.col-body {
text-align: center;
}
.col-body .van-icon
{
margin-bottom: 0.6rem;
.col-body .van-icon {
margin-bottom: 0.6rem;
}
p{
font-size: large;
font-weight:bold;
p {
font-size: large;
font-weight: bold;
}
</style>