mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-06-29 10:04:44 +08:00
style: format code
This commit is contained in:
parent
a3e931bacf
commit
f77566adcc
@ -1,40 +1,40 @@
|
||||
{
|
||||
"name": "@fesjs/plugin-layout",
|
||||
"version": "5.1.7",
|
||||
"description": "@fesjs/plugin-layout",
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"lib",
|
||||
"types.d.ts"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/WeBankFinTech/fes.js.git",
|
||||
"directory": "packages/fes-plugin-layout"
|
||||
},
|
||||
"keywords": [
|
||||
"fes"
|
||||
],
|
||||
"author": "harrywan",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/WeBankFinTech/fes.js/issues"
|
||||
},
|
||||
"homepage": "https://github.com/WeBankFinTech/fes.js#readme",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fesjs/utils": "^3.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@fesjs/fes": "^3.1.4",
|
||||
"@fesjs/fes-design": ">=0.7.0",
|
||||
"vue": "^3.2.47",
|
||||
"vue-router": "^4.0.1"
|
||||
},
|
||||
"typings": "./types.d.ts"
|
||||
"name": "@fesjs/plugin-layout",
|
||||
"version": "5.1.7",
|
||||
"description": "@fesjs/plugin-layout",
|
||||
"author": "harrywan",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/WeBankFinTech/fes.js#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/WeBankFinTech/fes.js.git",
|
||||
"directory": "packages/fes-plugin-layout"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/WeBankFinTech/fes.js/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"fes"
|
||||
],
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"lib",
|
||||
"types.d.ts"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@fesjs/fes": "^3.1.4",
|
||||
"@fesjs/fes-design": ">=0.7.0",
|
||||
"vue": "^3.2.47",
|
||||
"vue-router": "^4.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fesjs/utils": "^3.0.1"
|
||||
},
|
||||
"typings": "./types.d.ts"
|
||||
}
|
||||
|
@ -3,11 +3,11 @@ import { useRoute } from '@@/core/coreExports';
|
||||
|
||||
const cache = reactive(new Map());
|
||||
|
||||
export const getTitle = (path) => cache.get(path);
|
||||
export const getTitle = path => cache.get(path);
|
||||
|
||||
export const deleteTitle = (patch) => cache.delete(patch);
|
||||
export const deleteTitle = patch => cache.delete(patch);
|
||||
|
||||
export const useTabTitle = (title) => {
|
||||
export function useTabTitle(title) {
|
||||
const route = useRoute();
|
||||
const titleRef = ref(title);
|
||||
const path = route.path;
|
||||
@ -15,4 +15,4 @@ export const useTabTitle = (title) => {
|
||||
cache.set(path, titleRef);
|
||||
|
||||
return titleRef;
|
||||
};
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<template v-if="multiTabs">
|
||||
<FTabs
|
||||
:modelValue="route.path"
|
||||
:model-value="route.path"
|
||||
closable
|
||||
:tabsPadding="24"
|
||||
:tabs-padding="24"
|
||||
type="card"
|
||||
class="layout-content-tabs"
|
||||
@close="handleCloseTab"
|
||||
@ -21,17 +21,18 @@
|
||||
</FDropdown>
|
||||
</template>
|
||||
</FTabs>
|
||||
<Page ref="pageRef" :pageKey="getPageKey" isAllKeepAlive />
|
||||
<Page ref="pageRef" :page-key="getPageKey" is-all-keep-alive />
|
||||
</template>
|
||||
<Page v-else />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed, unref, ref } from 'vue';
|
||||
import { FTabs, FTabPane, FDropdown } from '@fesjs/fes-design';
|
||||
import { ReloadOutlined, MoreOutlined } from '@fesjs/fes-design/icon';
|
||||
import { useRouter, useRoute } from '@@/core/coreExports';
|
||||
import { computed, ref, unref } from 'vue';
|
||||
import { FDropdown, FTabPane, FTabs } from '@fesjs/fes-design';
|
||||
import { MoreOutlined, ReloadOutlined } from '@fesjs/fes-design/icon';
|
||||
import { useRoute, useRouter } from '@@/core/coreExports';
|
||||
import { transTitle } from '../helpers/pluginLocale';
|
||||
import { getTitle, deleteTitle } from '../useTitle';
|
||||
import { deleteTitle, getTitle } from '../useTitle';
|
||||
import Page from './page.vue';
|
||||
|
||||
let i = 0;
|
||||
@ -78,15 +79,16 @@ export default {
|
||||
},
|
||||
];
|
||||
|
||||
const findPage = (path) => pageList.value.find((item) => unref(item.path) === unref(path));
|
||||
const findPage = path => pageList.value.find(item => unref(item.path) === unref(path));
|
||||
|
||||
router.beforeEach((to) => {
|
||||
const page = findPage(to.path);
|
||||
if (!page) {
|
||||
if (!page)
|
||||
pageList.value = [...pageList.value, createPage(to)];
|
||||
} else {
|
||||
|
||||
else
|
||||
page.route = to;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
@ -107,11 +109,11 @@ export default {
|
||||
const index = list.indexOf(selectedPage);
|
||||
if (route.path === selectedPage.path) {
|
||||
if (list.length > 1) {
|
||||
if (list.length - 1 === index) {
|
||||
if (list.length - 1 === index)
|
||||
await switchPage(list[index - 1].path);
|
||||
} else {
|
||||
|
||||
else
|
||||
await switchPage(list[index + 1].path);
|
||||
}
|
||||
}
|
||||
}
|
||||
list.splice(index, 1);
|
||||
@ -121,9 +123,8 @@ export default {
|
||||
};
|
||||
const reloadPage = (path) => {
|
||||
const selectedPage = findPage(path || unref(route.path));
|
||||
if (selectedPage) {
|
||||
if (selectedPage)
|
||||
selectedPage.key = getKey();
|
||||
}
|
||||
};
|
||||
const closeOtherPage = (path) => {
|
||||
const selectedPage = findPage(path || unref(route.path));
|
||||
@ -132,9 +133,9 @@ export default {
|
||||
};
|
||||
const getPageKey = (_route) => {
|
||||
const selectedPage = findPage(_route.path);
|
||||
if (selectedPage) {
|
||||
if (selectedPage)
|
||||
return selectedPage.key;
|
||||
}
|
||||
|
||||
return '';
|
||||
};
|
||||
const handlerMore = (key) => {
|
||||
@ -163,6 +164,7 @@ export default {
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.layout-content-tabs {
|
||||
background: rgb(255, 255, 255);
|
||||
|
Loading…
x
Reference in New Issue
Block a user