From e1023bb3313282b00d6dcdefd5d7e30d7aaa1bfc Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期四, 30 十一月 2023 11:13:29 +0800 Subject: [PATCH] update 优化 代码中存在的警告 --- src/views/register.vue | 4 ++-- src/components/IconSelect/index.vue | 2 +- src/views/system/user/profile/userAvatar.vue | 4 ++-- src/views/tool/gen/index.vue | 4 ++-- src/store/modules/user.ts | 7 ++++++- src/layout/components/Sidebar/SidebarItem.vue | 4 ++-- 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/components/IconSelect/index.vue b/src/components/IconSelect/index.vue index a275954..1cd0023 100644 --- a/src/components/IconSelect/index.vue +++ b/src/components/IconSelect/index.vue @@ -2,7 +2,7 @@ <div class="relative" :style="{ width: width }"> <el-input v-model="modelValue" readonly @click="visible = !visible" placeholder="鐐瑰嚮閫夋嫨鍥炬爣"> <template #prepend> - <svg-icon :icon-class="modelValue as string" /> + <svg-icon :icon-class="modelValue" /> </template> </el-input> diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue index 204b19b..4459cdf 100644 --- a/src/layout/components/Sidebar/SidebarItem.vue +++ b/src/layout/components/Sidebar/SidebarItem.vue @@ -18,8 +18,8 @@ </template> <sidebar-item - v-for="(child) in item.children as RouteOption[]" - :key="child.path" + v-for="(child, index) in item.children" + :key="child.path + index" :is-nest="true" :item="child" :base-path="resolvePath(child.path)" diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 2593d1a..7c02de0 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -63,6 +63,10 @@ removeToken(); }; + const setAvatar = (value: string) => { + avatar.value = value; + }; + return { userId, token, @@ -72,7 +76,8 @@ permissions, login, getInfo, - logout + logout, + setAvatar }; }); diff --git a/src/views/register.vue b/src/views/register.vue index c2dd6a3..ad78cf1 100644 --- a/src/views/register.vue +++ b/src/views/register.vue @@ -105,12 +105,12 @@ const codeUrl = ref(""); const loading = ref(false); const captchaEnabled = ref(true); -const registerRef = ref(ElForm); +const registerRef = ref<ElFormInstance>(); // 绉熸埛鍒楄〃 const tenantList = ref<TenantVO[]>([]); const handleRegister = () => { - registerRef.value.validate(async (valid: boolean) => { + registerRef.value?.validate(async (valid: boolean) => { if (valid) { loading.value = true; const [err] = await to(register(registerForm.value)); diff --git a/src/views/system/user/profile/userAvatar.vue b/src/views/system/user/profile/userAvatar.vue index 0796765..5acfb76 100644 --- a/src/views/system/user/profile/userAvatar.vue +++ b/src/views/system/user/profile/userAvatar.vue @@ -1,6 +1,6 @@ <template> <div class="user-info-head" @click="editCropper()"> - <img :src="options.img as string" title="鐐瑰嚮涓婁紶澶村儚" class="img-circle img-lg" /> + <img :src="options.img" title="鐐瑰嚮涓婁紶澶村儚" class="img-circle img-lg" /> <el-dialog :title="title" v-model="open" width="800px" append-to-body @opened="modalOpened" @close="closeDialog"> <el-row> <el-col :xs="24" :md="12" :style="{ height: '350px' }"> @@ -140,7 +140,7 @@ const res = await uploadAvatar(formData); open.value = false; options.img = res.data.imgUrl; - userStore.avatar = options.img as string + userStore.setAvatar(options.img as string) proxy?.$modal.msgSuccess("淇敼鎴愬姛"); visible.value = false; }); diff --git a/src/views/tool/gen/index.vue b/src/views/tool/gen/index.vue index 82d5228..cb684f8 100644 --- a/src/views/tool/gen/index.vue +++ b/src/views/tool/gen/index.vue @@ -97,8 +97,8 @@ <el-tabs v-model="preview.activeName"> <el-tab-pane v-for="(value, key) in preview.data" - :label="(key as any).substring((key as any).lastIndexOf('/') + 1, (key as any).indexOf('.vm'))" - :name="(key as any).substring((key as any).lastIndexOf('/') + 1, (key as any).indexOf('.vm'))" + :label="key.substring(key.lastIndexOf('/') + 1, key.indexOf('.vm'))" + :name="key.substring(key.lastIndexOf('/') + 1, key.indexOf('.vm'))" :key="value" > <el-link :underline="false" icon="DocumentCopy" v-copyText="value" v-copyText:callback="copyTextSuccess" style="float:right"> -- Gitblit v1.9.3