审稿页面显示
This commit is contained in:
@@ -86,6 +86,7 @@ export default {
|
||||
props: ['home'],
|
||||
data() {
|
||||
return {
|
||||
localUsername: localStorage.getItem('U_name') || 'unknown user',
|
||||
isProofreading: false,
|
||||
collapse: false,
|
||||
fullscreen: false,
|
||||
@@ -131,9 +132,10 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
username() {
|
||||
let username = localStorage.getItem('U_name');
|
||||
return username ? username : this.name;
|
||||
|
||||
return this.localUsername ? this.localUsername : this.name;
|
||||
},
|
||||
onRoutes() {
|
||||
0;
|
||||
@@ -153,6 +155,11 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateUsername() {
|
||||
|
||||
this.localUsername = localStorage.getItem('U_name');
|
||||
|
||||
},
|
||||
goHome() {
|
||||
this.$router.push('/');
|
||||
},
|
||||
@@ -272,10 +279,19 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.$bus) { // 检查 $bus 是否存在,避免未定义错误
|
||||
this.$bus.$on('user-name-updated', this.updateUsername);
|
||||
}
|
||||
if (document.body.clientWidth < 1000) {
|
||||
this.collapseChage();
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
// 步骤 C2: 销毁前移除监听器
|
||||
if (this.$bus) {
|
||||
this.$bus.$off('user-name-updated', this.updateUsername);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
$route: {
|
||||
handler: function (route) {
|
||||
|
||||
Reference in New Issue
Block a user