mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-07 17:07:19 +08:00
style: eslint code
This commit is contained in:
parent
a2b200f5f2
commit
e85f36b76e
10
src/App.vue
10
src/App.vue
@ -5,9 +5,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ElConfigProvider } from "element-plus"
|
import { ElConfigProvider } from "element-plus";
|
||||||
import zhCn from "element-plus/lib/locale/lang/zh-cn"
|
import zhCn from "element-plus/lib/locale/lang/zh-cn";
|
||||||
import en from "element-plus/lib/locale/lang/en"
|
import en from "element-plus/lib/locale/lang/en";
|
||||||
export default {
|
export default {
|
||||||
name: "app",
|
name: "app",
|
||||||
components: {
|
components: {
|
||||||
@ -18,9 +18,9 @@ export default {
|
|||||||
currentLocale() {
|
currentLocale() {
|
||||||
switch (this.$storage.locale?.locale) {
|
switch (this.$storage.locale?.locale) {
|
||||||
case "zh":
|
case "zh":
|
||||||
return zhCn
|
return zhCn;
|
||||||
case "en":
|
case "en":
|
||||||
return en
|
return en;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,14 +12,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {
|
import { ref, unref, nextTick, onUnmounted } from "vue";
|
||||||
ref,
|
|
||||||
unref,
|
|
||||||
onBeforeMount,
|
|
||||||
getCurrentInstance,
|
|
||||||
nextTick,
|
|
||||||
onUnmounted
|
|
||||||
} from "vue";
|
|
||||||
import flippers from "./Filpper";
|
import flippers from "./Filpper";
|
||||||
|
|
||||||
import { templateRef } from "@vueuse/core";
|
import { templateRef } from "@vueuse/core";
|
||||||
|
@ -14,20 +14,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {
|
import { ref, unref, computed, defineComponent, getCurrentInstance } from "vue";
|
||||||
ref,
|
|
||||||
unref,
|
|
||||||
computed,
|
|
||||||
defineComponent,
|
|
||||||
onBeforeMount,
|
|
||||||
getCurrentInstance
|
|
||||||
} from "vue";
|
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import { useSettingStoreHook } from "/@/store/modules/settings";
|
import { useSettingStoreHook } from "/@/store/modules/settings";
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "appMain",
|
name: "appMain",
|
||||||
setup() {
|
setup() {
|
||||||
let vm: any;
|
|
||||||
const keepAlive: Boolean = ref(
|
const keepAlive: Boolean = ref(
|
||||||
getCurrentInstance().appContext.config.globalProperties.$config?.keepAlive
|
getCurrentInstance().appContext.config.globalProperties.$config?.keepAlive
|
||||||
);
|
);
|
||||||
|
@ -20,7 +20,11 @@
|
|||||||
>
|
>
|
||||||
<img :src="currentLocale ? ch : en" />
|
<img :src="currentLocale ? ch : en" />
|
||||||
</div>
|
</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">
|
<el-dropdown trigger="click">
|
||||||
<span class="el-dropdown-link">
|
<span class="el-dropdown-link">
|
||||||
@ -29,10 +33,9 @@
|
|||||||
</span>
|
</span>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-dropdown-item
|
<el-dropdown-item icon="el-icon-switch-button" @click="logout">
|
||||||
icon="el-icon-switch-button"
|
{{ $t("message.hsLoginOut") }}
|
||||||
@click="logout"
|
</el-dropdown-item>
|
||||||
>{{ $t("message.hsLoginOut") }}</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
@ -68,6 +71,7 @@ export default defineComponent({
|
|||||||
Hamburger,
|
Hamburger,
|
||||||
screenfull
|
screenfull
|
||||||
},
|
},
|
||||||
|
// @ts-ignore
|
||||||
computed: {
|
computed: {
|
||||||
// eslint-disable-next-line vue/return-in-computed-property
|
// eslint-disable-next-line vue/return-in-computed-property
|
||||||
currentLocale() {
|
currentLocale() {
|
||||||
|
@ -14,7 +14,9 @@
|
|||||||
@mouseenter.prevent="onMouseenter(item, index)"
|
@mouseenter.prevent="onMouseenter(item, index)"
|
||||||
@mouseleave.prevent="onMouseleave(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
|
<span
|
||||||
v-if="
|
v-if="
|
||||||
($route.path === item.path && index !== 0) ||
|
($route.path === item.path && index !== 0) ||
|
||||||
@ -38,7 +40,11 @@
|
|||||||
:style="{ left: buttonLeft + 'px', top: buttonTop + 'px' }"
|
:style="{ left: buttonLeft + 'px', top: buttonTop + 'px' }"
|
||||||
class="contextmenu"
|
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)">
|
<li v-if="item.show" @click="selectTag(item, key)">
|
||||||
<component :is="item.icon" :key="key" />
|
<component :is="item.icon" :key="key" />
|
||||||
{{ item.text }}
|
{{ item.text }}
|
||||||
@ -131,6 +137,7 @@ export default {
|
|||||||
!this.$storage.routesInStorage ||
|
!this.$storage.routesInStorage ||
|
||||||
this.$storage.routesInStorage.length === 0
|
this.$storage.routesInStorage.length === 0
|
||||||
) {
|
) {
|
||||||
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||||
this.$storage.routesInStorage = routerArrays;
|
this.$storage.routesInStorage = routerArrays;
|
||||||
}
|
}
|
||||||
return this.$storage.routesInStorage;
|
return this.$storage.routesInStorage;
|
||||||
@ -272,9 +279,6 @@ export default {
|
|||||||
|
|
||||||
if (tag === "other") {
|
if (tag === "other") {
|
||||||
spliceRoute(1, 1, true);
|
spliceRoute(1, 1, true);
|
||||||
// Array.from([2]).forEach(v => {
|
|
||||||
// tagsViews.value[v].disabled = true;
|
|
||||||
// });
|
|
||||||
} else if (tag === "left") {
|
} else if (tag === "left") {
|
||||||
spliceRoute(1, valueIndex - 1);
|
spliceRoute(1, valueIndex - 1);
|
||||||
} else if (tag === "right") {
|
} else if (tag === "right") {
|
||||||
@ -296,14 +300,6 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function deleteMenu(item, tag?: string) {
|
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);
|
deleteDynamicTag(item, route.path, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,6 +438,7 @@ export default {
|
|||||||
// 右键菜单不匹配当前路由,隐藏刷新
|
// 右键菜单不匹配当前路由,隐藏刷新
|
||||||
tagsViews.value[0].show = false;
|
tagsViews.value[0].show = false;
|
||||||
showMenuModel(tag.path);
|
showMenuModel(tag.path);
|
||||||
|
// eslint-disable-next-line no-dupe-else-if
|
||||||
} else if (st.routesInStorage.length === 2 && route.path !== tag.path) {
|
} else if (st.routesInStorage.length === 2 && route.path !== tag.path) {
|
||||||
showMenus(true);
|
showMenus(true);
|
||||||
// 只有两个标签时不显示关闭其他标签页
|
// 只有两个标签时不显示关闭其他标签页
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import defaultSettings from "../../settings"
|
import defaultSettings from "../../settings";
|
||||||
import { defineStore } from "pinia"
|
import { defineStore } from "pinia";
|
||||||
import { store } from "/@/store"
|
import { store } from "/@/store";
|
||||||
|
|
||||||
interface SettingState {
|
interface SettingState {
|
||||||
title: string
|
title: string;
|
||||||
fixedHeader: boolean
|
fixedHeader: boolean;
|
||||||
cachedPageList: string[]
|
cachedPageList: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useSettingStore = defineStore({
|
export const useSettingStore = defineStore({
|
||||||
@ -18,25 +18,25 @@ export const useSettingStore = defineStore({
|
|||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
getTitle() {
|
getTitle() {
|
||||||
return this.title
|
return this.title;
|
||||||
},
|
},
|
||||||
getFixedHeader() {
|
getFixedHeader() {
|
||||||
return this.fixedHeader
|
return this.fixedHeader;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
CHANGE_SETTING({ key, value }) {
|
CHANGE_SETTING({ key, value }) {
|
||||||
// eslint-disable-next-line no-prototype-builtins
|
// eslint-disable-next-line no-prototype-builtins
|
||||||
if (this.hasOwnProperty(key)) {
|
if (this.hasOwnProperty(key)) {
|
||||||
this[key] = value
|
this[key] = value;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeSetting(data) {
|
changeSetting(data) {
|
||||||
this.CHANGE_SETTING(data)
|
this.CHANGE_SETTING(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
export function useSettingStoreHook() {
|
export function useSettingStoreHook() {
|
||||||
return useSettingStore(store)
|
return useSettingStore(store);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user