From 87102caaf4520ab3c55906a2a94f11cb625811a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B5=B5=E4=BF=8A=E5=93=B2?= <1429595365@qq.com>
Date: Fri, 19 Jan 2024 11:35:57 +0800
Subject: [PATCH] fix: bug-311
---
feature/src/App.vue | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/feature/src/App.vue b/feature/src/App.vue
index 578411f..4f951d8 100644
--- a/feature/src/App.vue
+++ b/feature/src/App.vue
@@ -50,7 +50,7 @@
- {{ perf.custom.username }}
+ {{ computedUsername }}
@@ -97,6 +97,7 @@ import {
import { useStore } from 'vuex';
import localConfig from '@/confOp';
+const MAX_USERNAME_LEN = 5;// 最大展示的用户名长度
const store = useStore();
const router = useRouter();
const active = computed(() => store.state.active);
@@ -106,6 +107,15 @@ const changeMenu = (key: any) => {
store.commit('commonUpdate', {active: [key]})
router.push(key);
};
+const computedUsername = computed(() => {
+ const originUsername = perf?.custom?.username;
+ if (typeof originUsername === 'string'){
+ return originUsername.length > MAX_USERNAME_LEN
+ ? `${originUsername.slice(0, MAX_USERNAME_LEN)}...`
+ : originUsername;
+ }
+ return '';
+});
window.rubick.onPluginEnter(({ code }: { code: string }) => {
code = code === '已安装插件' ? 'installed' : code;