Browse Source

Merge pull request #796 from FlameMida/develop

web/src/components/customPic/index.vue:vite无法使用require函数
main
奇淼(piexlmax 3 years ago
committed by GitHub
parent
commit
f228426c57
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      web/src/components/customPic/index.vue

8
web/src/components/customPic/index.vue

@ -1,12 +1,12 @@
<template> <template>
<span class="headerAvatar"> <span class="headerAvatar">
<template v-if="picType === 'avatar'"> <template v-if="picType === 'avatar'">
<el-avatar v-if="userInfo.headerImg" :size="24" :src="avatar" />
<el-avatar v-else :size="24" :src="require('@/assets/noBody.png')" />
<el-avatar v-if="userInfo.headerImg" :size="30" :src="avatar" />
<el-avatar v-else :size="30" :src="noAvatar" />
</template> </template>
<template v-if="picType === 'img'"> <template v-if="picType === 'img'">
<img v-if="userInfo.headerImg" :src="avatar" class="avatar"> <img v-if="userInfo.headerImg" :src="avatar" class="avatar">
<img v-else :src="require('@/assets/noBody.png')" class="avatar">
<img v-else :src="noAvatar" class="avatar">
</template> </template>
<template v-if="picType === 'file'"> <template v-if="picType === 'file'">
<img :src="file" class="file"> <img :src="file" class="file">
@ -15,6 +15,7 @@
</template> </template>
<script> <script>
import noAvatar from '@/assets/noBody.png'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
const path = import.meta.env.VITE_BASE_API const path = import.meta.env.VITE_BASE_API
export default { export default {
@ -33,6 +34,7 @@ export default {
}, },
data() { data() {
return { return {
noAvatar: noAvatar,
path: path + '/' path: path + '/'
} }
}, },

Loading…
Cancel
Save