fix avatar

This commit is contained in:
AceDataCloud committed 2022-04-24 00:57:52 +08:00
1 parent 0329b0f519
commit 2bae7e0d0a
2 files changed
+8 -11

No files matched your search

+6 -9
View File
@@ -18,7 +18,7 @@
</div>
<div v-else class="mt-3 pr-10 float-right">
<el-dropdown trigger="click">
<img :src="avatar" class="avatar" />
<img :src="user.avatar || defaultAvatar" class="avatar" />
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="onLogout">{{ $t('common.button.logout') }}</el-dropdown-item>
@@ -34,11 +34,14 @@
<script lang="ts">
import { defineComponent } from 'vue';
import defaultAvatar from '@/assets/images/avatar.png';
export default defineComponent({
name: 'TopHeader',
data() {
return {};
return {
defaultAvatar
// defaultAvatar: new URL('@/assets/images/avatar.png', import.meta.url).href
};
},
computed: {
active() {
@@ -46,12 +49,6 @@ export default defineComponent({
},
user() {
return this.$store.getters.user;
},
avatar() {
if (this.user && this.user.avatar) {
return this.user.avatar;
}
return require('@/assets/images/avatar.png');
}
},
methods: {
+2 -2
View File
@@ -9,7 +9,7 @@ import { defineComponent } from 'vue';
import VuePlyr from 'vue-plyr';
import 'vue-plyr/dist/vue-plyr.css';
import Hls from 'hls.js';
import Plyr from 'plyr';
// import Plyr from 'plyr';
interface IData {
options: {};
@@ -47,7 +47,7 @@ export default defineComponent({
mounted() {
this.mounted = true;
const video = this.$refs.video as HTMLMediaElement;
this.player = (this.$refs.plyr as typeof VuePlyr).player as Plyr;
this.player = (this.$refs.plyr as typeof VuePlyr).player;
this.hls = new Hls() as Hls;
this.hls?.loadSource(this.resource);
this.hls?.attachMedia(video);