diff --git a/packages/fes-plugin-layout/package.json b/packages/fes-plugin-layout/package.json
index 1f1af348..e20386ef 100644
--- a/packages/fes-plugin-layout/package.json
+++ b/packages/fes-plugin-layout/package.json
@@ -1,40 +1,41 @@
{
- "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",
+ "@vueuse/core": "^10.7.0"
+ },
+ "typings": "./types.d.ts"
}
diff --git a/packages/fes-plugin-layout/src/index.js b/packages/fes-plugin-layout/src/index.js
index 999ca432..5ff334de 100644
--- a/packages/fes-plugin-layout/src/index.js
+++ b/packages/fes-plugin-layout/src/index.js
@@ -1,5 +1,5 @@
-import { readFileSync } from 'fs';
-import { join } from 'path';
+import { readFileSync } from 'node:fs';
+import { join } from 'node:path';
import { winPath } from '@fesjs/utils';
import { name } from '../package.json';
@@ -40,7 +40,7 @@ export default (api) => {
const iconNames = helper.getIconNamesFromMenu(userConfig.menus);
- const iconsString = iconNames.map((iconName) => `import { ${iconName} } from '@fesjs/fes-design/icon'`);
+ const iconsString = iconNames.map(iconName => `import { ${iconName} } from '@fesjs/fes-design/icon'`);
api.writeTmpFile({
path: join(namespace, 'icons.js'),
content: `
@@ -84,7 +84,7 @@ export default (api) => {
api.addPluginExports(() => [
{
- specifiers: ['Page', 'useTabTitle'],
+ specifiers: ['Page', 'useTabTitle', 'useLayout'],
source: join(namespace, 'index.js'),
},
]);
@@ -92,7 +92,7 @@ export default (api) => {
// 把 BaseLayout插入到路由配置中,作为根路由
// 添加 403 和 404 路由
api.modifyRoutes((routes) => {
- if (!routes.find((item) => item.path === '/403')) {
+ if (!routes.find(item => item.path === '/403')) {
routes.push({
path: '/403',
name: 'Exception403',
@@ -102,7 +102,7 @@ export default (api) => {
},
});
}
- if (!routes.find((item) => item.path === '/404')) {
+ if (!routes.find(item => item.path === '/404')) {
routes.push({
path: '/404',
name: 'Exception404',
diff --git a/packages/fes-plugin-layout/src/runtime/index.js b/packages/fes-plugin-layout/src/runtime/index.js
index 5117f920..f5738924 100644
--- a/packages/fes-plugin-layout/src/runtime/index.js
+++ b/packages/fes-plugin-layout/src/runtime/index.js
@@ -1,2 +1,3 @@
export { default as Page } from './views/page.vue';
export { useTabTitle } from './useTitle';
+export * from './useLayout';
diff --git a/packages/fes-plugin-layout/src/runtime/useLayout.js b/packages/fes-plugin-layout/src/runtime/useLayout.js
new file mode 100644
index 00000000..452cf17d
--- /dev/null
+++ b/packages/fes-plugin-layout/src/runtime/useLayout.js
@@ -0,0 +1,12 @@
+import { createSharedComposable } from '@vueuse/core';
+import { shallowReactive } from 'vue';
+
+function _useLayout() {
+ const state = shallowReactive({
+ closeTab: () => {},
+ });
+
+ return state;
+}
+
+export const useLayout = createSharedComposable(_useLayout);
diff --git a/packages/fes-plugin-layout/src/runtime/useTitle.js b/packages/fes-plugin-layout/src/runtime/useTitle.js
index e56636e4..f0417953 100644
--- a/packages/fes-plugin-layout/src/runtime/useTitle.js
+++ b/packages/fes-plugin-layout/src/runtime/useTitle.js
@@ -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;
-};
+}
diff --git a/packages/fes-plugin-layout/src/runtime/views/MultiTabProvider.vue b/packages/fes-plugin-layout/src/runtime/views/MultiTabProvider.vue
index 1066fedc..96b9e683 100644
--- a/packages/fes-plugin-layout/src/runtime/views/MultiTabProvider.vue
+++ b/packages/fes-plugin-layout/src/runtime/views/MultiTabProvider.vue
@@ -1,9 +1,9 @@
-
+
+
+