Skip to content

Commit

Permalink
style: format code
Browse files Browse the repository at this point in the history
  • Loading branch information
winixt committed Dec 18, 2023
1 parent a3e931b commit f77566a
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 61 deletions.
76 changes: 38 additions & 38 deletions packages/fes-plugin-layout/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
8 changes: 4 additions & 4 deletions packages/fes-plugin-layout/src/runtime/useTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ 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;

cache.set(path, titleRef);

return titleRef;
};
}
40 changes: 21 additions & 19 deletions packages/fes-plugin-layout/src/runtime/views/MultiTabProvider.vue
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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;
Expand Down Expand Up @@ -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;
});
Expand All @@ -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);
Expand All @@ -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));
Expand All @@ -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) => {
Expand Down Expand Up @@ -163,6 +164,7 @@ export default {
},
};
</script>
<style lang="less">
.layout-content-tabs {
background: rgb(255, 255, 255);
Expand Down

0 comments on commit f77566a

Please sign in to comment.