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>
|
<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';
|
const props = defineProps({
|
||||||
import { ref } from 'vue'
|
src: { type: String, default: "null", required: false },
|
||||||
const props= defineProps({
|
width: { type: String, default: "3rem", required: false },
|
||||||
src: {type:String,default:'null',required:false},
|
height: { type: String, default: "3rem", 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 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 {
|
||||||
font-size: large;
|
font-size: large;
|
||||||
font-weight:bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user