feat: app添加默认头像
This commit is contained in:
BIN
Yi.App.Vue3/src/assets/icon.jpg
Normal file
BIN
Yi.App.Vue3/src/assets/icon.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user