mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
Merge branch 'master' of https://github.com/WeBankFinTech/fes.js
This commit is contained in:
commit
36cbce55d1
@ -56,21 +56,21 @@ export default {
|
|||||||
}
|
}
|
||||||
</config>
|
</config>
|
||||||
```
|
```
|
||||||
如果只是不想展示`side`,则:
|
如果只是不想展示`sidebar`,则:
|
||||||
```
|
```
|
||||||
<config lang="json">
|
<config lang="json">
|
||||||
{
|
{
|
||||||
"layout": {
|
"layout": {
|
||||||
"side": false
|
"sidebar": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</config>
|
</config>
|
||||||
```
|
```
|
||||||
`layout`的可选配置有:
|
`layout`的可选配置有:
|
||||||
|
|
||||||
- **side**: 左侧区域
|
- **sidebar**: 左侧区域,从v4.0.0开始,之前名称叫`side`
|
||||||
|
|
||||||
- **top**: 头部区域
|
- **header**: 头部区域,,从v4.0.0开始,之前名称叫`top`
|
||||||
|
|
||||||
- **logo**:logo和标题区域。
|
- **logo**:logo和标题区域。
|
||||||
|
|
||||||
@ -183,6 +183,15 @@ export default {
|
|||||||
|
|
||||||
- **path**:菜单的路径,可配置第三方地址。
|
- **path**:菜单的路径,可配置第三方地址。
|
||||||
|
|
||||||
|
- **match**:额外匹配的路径,当前路由命中匹配规则时,此菜单高亮。 (v4.0.0+)
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
path: '/product',
|
||||||
|
match: ['/product/*', '/product/create']
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
- **title**:菜单的标题,如果同时使用[国际化插件](./locale.md),而且`title`的值以`$`开头,则使用`$`后面的内容去匹配语言设置。
|
- **title**:菜单的标题,如果同时使用[国际化插件](./locale.md),而且`title`的值以`$`开头,则使用`$`后面的内容去匹配语言设置。
|
||||||
|
|
||||||
- **icon**: 菜单的图标,只有一级标题展示图标。
|
- **icon**: 菜单的图标,只有一级标题展示图标。
|
||||||
|
@ -56,21 +56,21 @@ export default {
|
|||||||
}
|
}
|
||||||
</config>
|
</config>
|
||||||
```
|
```
|
||||||
如果只是不想展示`side`,则:
|
如果只是不想展示`sidebar`,则:
|
||||||
```
|
```
|
||||||
<config lang="json">
|
<config lang="json">
|
||||||
{
|
{
|
||||||
"layout": {
|
"layout": {
|
||||||
"side": false
|
"sidebar": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</config>
|
</config>
|
||||||
```
|
```
|
||||||
`layout`的可选配置有:
|
`layout`的可选配置有:
|
||||||
|
|
||||||
- **side**: 左侧区域
|
- **sidebar**: 左侧区域,从v4.0.0开始,之前名称叫`side`
|
||||||
|
|
||||||
- **top**: 头部区域
|
- **header**: 头部区域,,从v4.0.0开始,之前名称叫`top`
|
||||||
|
|
||||||
- **logo**:logo和标题区域。
|
- **logo**:logo和标题区域。
|
||||||
|
|
||||||
@ -183,6 +183,15 @@ export default {
|
|||||||
|
|
||||||
- **path**:菜单的路径,可配置第三方地址。
|
- **path**:菜单的路径,可配置第三方地址。
|
||||||
|
|
||||||
|
- **match**:额外匹配的路径,当前路由命中匹配规则时,此菜单高亮。 (v4.0.0+)
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
path: '/product',
|
||||||
|
match: ['/product/*', '/product/create']
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
- **title**:菜单的标题,如果同时使用[国际化插件](./locale.md),而且`title`的值以`$`开头,则使用`$`后面的内容去匹配语言设置。
|
- **title**:菜单的标题,如果同时使用[国际化插件](./locale.md),而且`title`的值以`$`开头,则使用`$`后面的内容去匹配语言设置。
|
||||||
|
|
||||||
- **icon**: 菜单的图标,只有一级标题展示图标。
|
- **icon**: 菜单的图标,只有一级标题展示图标。
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@fesjs/create-fes-app",
|
"name": "@fesjs/create-fes-app",
|
||||||
"version": "2.1.1",
|
"version": "2.1.2",
|
||||||
"description": "create a app base on fes.js",
|
"description": "create a app base on fes.js",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
1
packages/create-fes-app/templates/app/h5/.npmrc
Normal file
1
packages/create-fes-app/templates/app/h5/.npmrc
Normal file
@ -0,0 +1 @@
|
|||||||
|
public-hoist-pattern[]=@babel/*
|
@ -48,7 +48,8 @@
|
|||||||
"@fesjs/fes": "^2.0.0",
|
"@fesjs/fes": "^2.0.0",
|
||||||
"@fesjs/plugin-icon": "^2.0.0",
|
"@fesjs/plugin-icon": "^2.0.0",
|
||||||
"@fesjs/plugin-request": "^2.0.0",
|
"@fesjs/plugin-request": "^2.0.0",
|
||||||
"vue": "^3.2.6"
|
"vue": "^3.2.6",
|
||||||
|
"core-js": "^3.8.3"
|
||||||
},
|
},
|
||||||
"private": true
|
"private": true
|
||||||
}
|
}
|
@ -12,6 +12,7 @@ export default {
|
|||||||
layout: {
|
layout: {
|
||||||
title: "Fes.js",
|
title: "Fes.js",
|
||||||
footer: 'Created by MumbleFE',
|
footer: 'Created by MumbleFE',
|
||||||
|
navigation: 'mixin',
|
||||||
multiTabs: false,
|
multiTabs: false,
|
||||||
menus: [{
|
menus: [{
|
||||||
name: 'index'
|
name: 'index'
|
||||||
|
1
packages/create-fes-app/templates/app/pc/.npmrc
Normal file
1
packages/create-fes-app/templates/app/pc/.npmrc
Normal file
@ -0,0 +1 @@
|
|||||||
|
public-hoist-pattern[]=@babel/*
|
@ -53,7 +53,8 @@
|
|||||||
"@fesjs/plugin-model": "^2.0.0",
|
"@fesjs/plugin-model": "^2.0.0",
|
||||||
"@fesjs/plugin-enums": "^2.0.0",
|
"@fesjs/plugin-enums": "^2.0.0",
|
||||||
"@fesjs/fes-design": "^0.1.10",
|
"@fesjs/fes-design": "^0.1.10",
|
||||||
"vue": "^3.2.6"
|
"vue": "^3.2.6",
|
||||||
|
"core-js": "^3.8.3"
|
||||||
},
|
},
|
||||||
"private": true
|
"private": true
|
||||||
}
|
}
|
3
packages/create-fes-app/templates/app/pc/src/global.less
Normal file
3
packages/create-fes-app/templates/app/pc/src/global.less
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
body, html {
|
||||||
|
margin: 0;
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@fesjs/plugin-layout",
|
"name": "@fesjs/plugin-layout",
|
||||||
"version": "3.0.0",
|
"version": "4.0.0",
|
||||||
"description": "@fesjs/plugin-layout",
|
"description": "@fesjs/plugin-layout",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
9
packages/fes-plugin-layout/src/runtime/helpers/utils.js
Normal file
9
packages/fes-plugin-layout/src/runtime/helpers/utils.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
export const flatNodes = (nodes = []) => nodes.reduce((res, node) => {
|
||||||
|
res.push(node);
|
||||||
|
if (node.children) {
|
||||||
|
res = res.concat(
|
||||||
|
flatNodes(node.children)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}, []);
|
@ -2,7 +2,7 @@
|
|||||||
<f-layout v-if="routeLayout" class="main-layout">
|
<f-layout v-if="routeLayout" class="main-layout">
|
||||||
<template v-if="navigation === 'side'">
|
<template v-if="navigation === 'side'">
|
||||||
<f-aside
|
<f-aside
|
||||||
v-if="routeLayout.side"
|
v-if="routeLayout.sidebar"
|
||||||
v-model:collapsed="collapsed"
|
v-model:collapsed="collapsed"
|
||||||
:fixed="fixedSideBar"
|
:fixed="fixedSideBar"
|
||||||
class="layout-aside"
|
class="layout-aside"
|
||||||
@ -32,7 +32,7 @@
|
|||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<f-header
|
<f-header
|
||||||
v-if="routeLayout.top"
|
v-if="routeLayout.header"
|
||||||
class="layout-header"
|
class="layout-header"
|
||||||
:fixed="currentFixedHeader"
|
:fixed="currentFixedHeader"
|
||||||
>
|
>
|
||||||
@ -59,7 +59,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-if="navigation === 'top'">
|
<template v-if="navigation === 'top'">
|
||||||
<f-header
|
<f-header
|
||||||
v-if="routeLayout.top"
|
v-if="routeLayout.header"
|
||||||
class="layout-header"
|
class="layout-header"
|
||||||
:inverted="theme === 'dark'"
|
:inverted="theme === 'dark'"
|
||||||
:fixed="currentFixedHeader"
|
:fixed="currentFixedHeader"
|
||||||
@ -96,7 +96,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-if="navigation === 'mixin'">
|
<template v-if="navigation === 'mixin'">
|
||||||
<f-header
|
<f-header
|
||||||
v-if="routeLayout.top"
|
v-if="routeLayout.header"
|
||||||
class="layout-header"
|
class="layout-header"
|
||||||
:fixed="currentFixedHeader"
|
:fixed="currentFixedHeader"
|
||||||
:inverted="theme === 'dark'"
|
:inverted="theme === 'dark'"
|
||||||
@ -117,7 +117,7 @@
|
|||||||
:style="{ top: currentFixedHeader ? '54px' : 'auto' }"
|
:style="{ top: currentFixedHeader ? '54px' : 'auto' }"
|
||||||
>
|
>
|
||||||
<f-aside
|
<f-aside
|
||||||
v-if="routeLayout.side"
|
v-if="routeLayout.sidebar"
|
||||||
v-model:collapsed="collapsed"
|
v-model:collapsed="collapsed"
|
||||||
:fixed="fixedSideBar"
|
:fixed="fixedSideBar"
|
||||||
collapsible
|
collapsible
|
||||||
@ -226,8 +226,8 @@ export default {
|
|||||||
key: 'layout',
|
key: 'layout',
|
||||||
type: ApplyPluginsType.modify,
|
type: ApplyPluginsType.modify,
|
||||||
initialValue: {
|
initialValue: {
|
||||||
side: true,
|
sidebar: true,
|
||||||
top: true,
|
header: true,
|
||||||
logo: true
|
logo: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<f-menu
|
<f-menu
|
||||||
:modelValue="route.path"
|
:modelValue="activePath"
|
||||||
:inverted="inverted"
|
:inverted="inverted"
|
||||||
:mode="mode"
|
:mode="mode"
|
||||||
:options="fixedMenus"
|
:options="fixedMenus"
|
||||||
@ -15,6 +15,7 @@ import { useRoute, useRouter } from '@@/core/coreExports';
|
|||||||
import MenuIcon from './MenuIcon';
|
import MenuIcon from './MenuIcon';
|
||||||
import { transform as transformByAccess } from '../helpers/pluginAccess';
|
import { transform as transformByAccess } from '../helpers/pluginAccess';
|
||||||
import { transform as transformByLocale } from '../helpers/pluginLocale';
|
import { transform as transformByLocale } from '../helpers/pluginLocale';
|
||||||
|
import { flatNodes } from '../helpers/utils';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -56,6 +57,23 @@ export default {
|
|||||||
return copy;
|
return copy;
|
||||||
});
|
});
|
||||||
const fixedMenus = computed(() => transformByLocale(transformByAccess(transform(props.menus))));
|
const fixedMenus = computed(() => transformByLocale(transformByAccess(transform(props.menus))));
|
||||||
|
const menus = computed(() => flatNodes(fixedMenus.value));
|
||||||
|
const activePath = computed(() => {
|
||||||
|
const matchMenus = menus.value.filter((menu) => {
|
||||||
|
const match = menu.match;
|
||||||
|
if (!match || !Array.isArray(match)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return match.some((str) => {
|
||||||
|
const reg = new RegExp(str);
|
||||||
|
return reg.test(route.path);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if (matchMenus.length === 0) {
|
||||||
|
return route.path;
|
||||||
|
}
|
||||||
|
return matchMenus[0].path;
|
||||||
|
});
|
||||||
const onMenuClick = (e) => {
|
const onMenuClick = (e) => {
|
||||||
const path = e.value;
|
const path = e.value;
|
||||||
if (/^https?:\/\//.test(path)) {
|
if (/^https?:\/\//.test(path)) {
|
||||||
@ -69,7 +87,7 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
route,
|
activePath,
|
||||||
fixedMenus,
|
fixedMenus,
|
||||||
onMenuClick
|
onMenuClick
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@fesjs/preset-built-in",
|
"name": "@fesjs/preset-built-in",
|
||||||
"version": "2.0.12",
|
"version": "2.0.14",
|
||||||
"description": "@fesjs/preset-built-in",
|
"description": "@fesjs/preset-built-in",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
@ -73,6 +73,7 @@
|
|||||||
"webpackbar": "^5.0.0-3"
|
"webpackbar": "^5.0.0-3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@vue/compiler-sfc": "^3.0.5"
|
"@vue/compiler-sfc": "^3.0.5",
|
||||||
|
"core-js": "^3.8.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 50 KiB |
@ -82,6 +82,7 @@ export default async function getConfig({
|
|||||||
// --------------- cache -----------
|
// --------------- cache -----------
|
||||||
webpackConfig.cache({
|
webpackConfig.cache({
|
||||||
type: 'filesystem',
|
type: 'filesystem',
|
||||||
|
version: require('../../../../package.json').version,
|
||||||
cacheDirectory: join(cwd, '.cache/webpack')
|
cacheDirectory: join(cwd, '.cache/webpack')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -10,12 +10,12 @@ export default {
|
|||||||
title: '海贼王'
|
title: '海贼王'
|
||||||
},
|
},
|
||||||
router: {
|
router: {
|
||||||
mode: 'history'
|
mode: 'hash'
|
||||||
},
|
},
|
||||||
access: {
|
access: {
|
||||||
roles: {
|
roles: {
|
||||||
admin: ['*'],
|
admin: ['*'],
|
||||||
menuTest: ['/','/menuTest']
|
menuTest: ['/', '/menuTest']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
request: {
|
request: {
|
||||||
@ -39,7 +39,8 @@ export default {
|
|||||||
menus: [
|
menus: [
|
||||||
{
|
{
|
||||||
name: 'index',
|
name: 'index',
|
||||||
icon: '/wine-outline.svg'
|
icon: '/wine-outline.svg',
|
||||||
|
match: ['/route/*']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'store'
|
name: 'store'
|
||||||
@ -53,17 +54,20 @@ export default {
|
|||||||
icon: 'UserOutlined',
|
icon: 'UserOutlined',
|
||||||
path: 'https://www.baidu.com'
|
path: 'https://www.baidu.com'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'mock'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '菜单权限测试',
|
title: '菜单权限测试',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: '子菜单',
|
title: '子菜单',
|
||||||
path: '/menuTest',
|
path: '/menuTest'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '子菜单a',
|
title: '子菜单a',
|
||||||
path: '/menuTest/a'
|
path: '/menuTest/a'
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -3,5 +3,6 @@ export default {
|
|||||||
home: 'home',
|
home: 'home',
|
||||||
store: 'store',
|
store: 'store',
|
||||||
editor: 'editor',
|
editor: 'editor',
|
||||||
externalLink: 'externalLink'
|
externalLink: 'externalLink',
|
||||||
|
mock: 'mock'
|
||||||
};
|
};
|
||||||
|
@ -3,5 +3,6 @@ export default {
|
|||||||
home: '首页',
|
home: '首页',
|
||||||
store: '状态管理',
|
store: '状态管理',
|
||||||
editor: '编辑器',
|
editor: '编辑器',
|
||||||
externalLink: '外部链接'
|
externalLink: '外部链接',
|
||||||
|
mock: '代理'
|
||||||
};
|
};
|
||||||
|
49
packages/fes-template/src/pages/mock.vue
Normal file
49
packages/fes-template/src/pages/mock.vue
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
mock and proxy
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
"name": "mock",
|
||||||
|
"title": "$mock"
|
||||||
|
}
|
||||||
|
</config>
|
||||||
|
<script setup>
|
||||||
|
import { request } from '@fesjs/fes';
|
||||||
|
|
||||||
|
console.log('测试 mock!!');
|
||||||
|
|
||||||
|
request('/v2/file')
|
||||||
|
.then((data) => {
|
||||||
|
console.log(data);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
|
||||||
|
request('/v2/movie/in_theaters_mock', { a: 1 }, 'get')
|
||||||
|
.then((data) => {
|
||||||
|
console.log(data);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('测试 proxy!!');
|
||||||
|
|
||||||
|
request(
|
||||||
|
'/v2/movie/in_theaters_proxy',
|
||||||
|
{ a: 1 },
|
||||||
|
{
|
||||||
|
method: 'get',
|
||||||
|
headers: { Accept: '*/*' }
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then((resp) => {
|
||||||
|
console.log(resp);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
</script>
|
23
packages/fes-template/src/pages/route/@id.vue
Normal file
23
packages/fes-template/src/pages/route/@id.vue
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
{{params.id}}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
"name": "activeRoute",
|
||||||
|
"title": "动态路由"
|
||||||
|
}
|
||||||
|
</config>
|
||||||
|
<script>
|
||||||
|
import { useRoute } from '@fesjs/fes';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
setup() {
|
||||||
|
const { params } = useRoute();
|
||||||
|
return {
|
||||||
|
params
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@fesjs/fes",
|
"name": "@fesjs/fes",
|
||||||
"version": "2.0.13",
|
"version": "2.0.15",
|
||||||
"description": "一个好用的前端管理台快速开发框架",
|
"description": "一个好用的前端管理台快速开发框架",
|
||||||
"preferGlobal": true,
|
"preferGlobal": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -39,7 +39,7 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fesjs/compiler": "^2.0.3",
|
"@fesjs/compiler": "^2.0.3",
|
||||||
"@fesjs/preset-built-in": "^2.0.12",
|
"@fesjs/preset-built-in": "^2.0.14",
|
||||||
"@fesjs/runtime": "^2.0.2",
|
"@fesjs/runtime": "^2.0.2",
|
||||||
"@fesjs/utils": "^2.0.3",
|
"@fesjs/utils": "^2.0.3",
|
||||||
"resolve-cwd": "^3.0.0"
|
"resolve-cwd": "^3.0.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user