Browse Source

style: eslint code

xiaoxian521 3 years ago
parent
commit
e85f36b76e

+ 5 - 5
src/App.vue

@@ -5,9 +5,9 @@
 </template>
 
 <script>
-import { ElConfigProvider } from "element-plus"
-import zhCn from "element-plus/lib/locale/lang/zh-cn"
-import en from "element-plus/lib/locale/lang/en"
+import { ElConfigProvider } from "element-plus";
+import zhCn from "element-plus/lib/locale/lang/zh-cn";
+import en from "element-plus/lib/locale/lang/en";
 export default {
   name: "app",
   components: {
@@ -18,9 +18,9 @@ export default {
     currentLocale() {
       switch (this.$storage.locale?.locale) {
         case "zh":
-          return zhCn
+          return zhCn;
         case "en":
-          return en
+          return en;
       }
     }
   }

+ 1 - 8
src/components/ReFlop/src/index.vue

@@ -12,14 +12,7 @@
 </template>
 
 <script lang="ts">
-import {
-  ref,
-  unref,
-  onBeforeMount,
-  getCurrentInstance,
-  nextTick,
-  onUnmounted
-} from "vue";
+import { ref, unref, nextTick, onUnmounted } from "vue";
 import flippers from "./Filpper";
 
 import { templateRef } from "@vueuse/core";

+ 1 - 9
src/layout/components/AppMain.vue

@@ -14,20 +14,12 @@
 </template>
 
 <script lang="ts">
-import {
-  ref,
-  unref,
-  computed,
-  defineComponent,
-  onBeforeMount,
-  getCurrentInstance
-} from "vue";
+import { ref, unref, computed, defineComponent, getCurrentInstance } from "vue";
 import { useRoute } from "vue-router";
 import { useSettingStoreHook } from "/@/store/modules/settings";
 export default defineComponent({
   name: "appMain",
   setup() {
-    let vm: any;
     const keepAlive: Boolean = ref(
       getCurrentInstance().appContext.config.globalProperties.$config?.keepAlive
     );

+ 9 - 5
src/layout/components/Navbar.vue

@@ -20,7 +20,11 @@
       >
         <img :src="currentLocale ? ch : en" />
       </div>
-      <i class="el-icon-setting hsset" :title="$t('message.hssystemSet')" @click="onPanel"></i>
+      <i
+        class="el-icon-setting hsset"
+        :title="$t('message.hssystemSet')"
+        @click="onPanel"
+      ></i>
       <!-- 退出登陆 -->
       <el-dropdown trigger="click">
         <span class="el-dropdown-link">
@@ -29,10 +33,9 @@
         </span>
         <template #dropdown>
           <el-dropdown-menu>
-            <el-dropdown-item
-              icon="el-icon-switch-button"
-              @click="logout"
-            >{{ $t("message.hsLoginOut") }}</el-dropdown-item>
+            <el-dropdown-item icon="el-icon-switch-button" @click="logout">
+              {{ $t("message.hsLoginOut") }}
+            </el-dropdown-item>
           </el-dropdown-menu>
         </template>
       </el-dropdown>
@@ -68,6 +71,7 @@ export default defineComponent({
     Hamburger,
     screenfull
   },
+  // @ts-ignore
   computed: {
     // eslint-disable-next-line vue/return-in-computed-property
     currentLocale() {

+ 10 - 13
src/layout/components/tag/index.vue

@@ -14,7 +14,9 @@
         @mouseenter.prevent="onMouseenter(item, index)"
         @mouseleave.prevent="onMouseleave(item, index)"
       >
-        <router-link :to="item.path" @click="tagOnClick(item)">{{ $t(item.meta.title) }}</router-link>
+        <router-link :to="item.path" @click="tagOnClick(item)">
+          {{ $t(item.meta.title) }}
+        </router-link>
         <span
           v-if="
             ($route.path === item.path && index !== 0) ||
@@ -38,7 +40,11 @@
         :style="{ left: buttonLeft + 'px', top: buttonTop + 'px' }"
         class="contextmenu"
       >
-        <div v-for="(item, key) in tagsViews" :key="key" style="display: flex; align-items: center">
+        <div
+          v-for="(item, key) in tagsViews"
+          :key="key"
+          style="display: flex; align-items: center"
+        >
           <li v-if="item.show" @click="selectTag(item, key)">
             <component :is="item.icon" :key="key" />
             {{ item.text }}
@@ -131,6 +137,7 @@ export default {
         !this.$storage.routesInStorage ||
         this.$storage.routesInStorage.length === 0
       ) {
+        // eslint-disable-next-line vue/no-side-effects-in-computed-properties
         this.$storage.routesInStorage = routerArrays;
       }
       return this.$storage.routesInStorage;
@@ -272,9 +279,6 @@ export default {
 
       if (tag === "other") {
         spliceRoute(1, 1, true);
-        // Array.from([2]).forEach(v => {
-        //   tagsViews.value[v].disabled = true;
-        // });
       } else if (tag === "left") {
         spliceRoute(1, valueIndex - 1);
       } else if (tag === "right") {
@@ -296,14 +300,6 @@ export default {
     }
 
     function deleteMenu(item, tag?: string) {
-      // if (routerArrays.length === 2) {
-      //   Array.from([1, 2, 3]).forEach(v => {
-      //     tagsViews.value[v].disabled = true;
-      //   });
-      // }
-      // if (routerArrays.length === 3) {
-      //   tagsViews.value[2].disabled = true;
-      // }
       deleteDynamicTag(item, route.path, tag);
     }
 
@@ -442,6 +438,7 @@ export default {
         // 右键菜单不匹配当前路由,隐藏刷新
         tagsViews.value[0].show = false;
         showMenuModel(tag.path);
+        // eslint-disable-next-line no-dupe-else-if
       } else if (st.routesInStorage.length === 2 && route.path !== tag.path) {
         showMenus(true);
         // 只有两个标签时不显示关闭其他标签页

+ 12 - 12
src/store/modules/settings.ts

@@ -1,11 +1,11 @@
-import defaultSettings from "../../settings"
-import { defineStore } from "pinia"
-import { store } from "/@/store"
+import defaultSettings from "../../settings";
+import { defineStore } from "pinia";
+import { store } from "/@/store";
 
 interface SettingState {
-  title: string
-  fixedHeader: boolean
-  cachedPageList: string[]
+  title: string;
+  fixedHeader: boolean;
+  cachedPageList: string[];
 }
 
 export const useSettingStore = defineStore({
@@ -18,25 +18,25 @@ export const useSettingStore = defineStore({
   }),
   getters: {
     getTitle() {
-      return this.title
+      return this.title;
     },
     getFixedHeader() {
-      return this.fixedHeader
+      return this.fixedHeader;
     }
   },
   actions: {
     CHANGE_SETTING({ key, value }) {
       // eslint-disable-next-line no-prototype-builtins
       if (this.hasOwnProperty(key)) {
-        this[key] = value
+        this[key] = value;
       }
     },
     changeSetting(data) {
-      this.CHANGE_SETTING(data)
+      this.CHANGE_SETTING(data);
     }
   }
-})
+});
 
 export function useSettingStoreHook() {
-  return useSettingStore(store)
+  return useSettingStore(store);
 }