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,31 +1,31 @@
<template> <template>
<van-image <van-image round :width="width" :height="height" :src="getUrl()" />
round
:width="width"
:height="height"
:src="url+(src??'0')"
/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { type } from 'os';
import { ref } from 'vue'
const props = defineProps({ const props = defineProps({
src: {type:String,default:'null',required:false}, src: { type: String, default: "null", required: false },
width:{type:String,default:'3rem',required:false}, width: { type: String, default: "3rem", required: false },
height:{type:String,default:'3rem',required:false} height: { type: String, default: "3rem", required: false },
}) });
const url = `${import.meta.env.VITE_APP_BASE_API}/file/`; 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> </script>
<style scoped> <style scoped>
.col-body .col-body {
{
text-align: center; text-align: center;
} }
.col-body .van-icon .col-body .van-icon {
{
margin-bottom: 0.6rem; margin-bottom: 0.6rem;
} }
p { p {