Skip to content

Commit

Permalink
fix: copyright prop string type error
Browse files Browse the repository at this point in the history
  • Loading branch information
sendya committed Nov 18, 2021
1 parent 9dbbd49 commit f4b995c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 15 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ const layoutConf = reactive({
| menuSubItemRender | custom render Menu.SubItem | v-slot#menuSubItemRender="{ item, icon }" \| ({ item, icon }) => VNode | null |
| locale | i18n | Function (key: string) => string \| `false` | `false` |

> Menu generation requires `getMenuData` and `clearMenuItem` function
> e.g. `const { menuData } = getMenuData(clearMenuItem(routes))`
### PageContainer

| Property | Description | Type | Default Value |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ant-design-vue/pro-layout",
"version": "3.1.3",
"version": "3.1.4",
"license": "MIT",
"files": [
"dist"
Expand Down
1 change: 0 additions & 1 deletion src/BasicLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ const ProLayout = defineComponent({
'menuClick',
],
setup(props, { emit, slots }) {
console.log('props', props);
const isTop = computed(() => props.layout === 'top');
const hasSide = computed(() => props.layout === 'mix' || props.layout === 'side' || false);
const hasSplitMenu = computed(() => props.layout === 'mix' && props.splitMenus);
Expand Down
9 changes: 0 additions & 9 deletions src/FooterToolbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,9 @@ const FooterToolbar = defineComponent({
if (!siderWidth || layout === 'top') {
return '100%';
}
console.log(
'x',
unref(siderWidth),
'hasFlatMenu',
unref(hasFlatMenu),
'hasSide',
unref(context.hasSide),
);
if (!hasFlatMenu.value && !unref(hasSide)) {
return '100%';
}
console.log('x2', unref(context.hasSide));
return isMobile ? '100%' : `calc(100% - ${siderWidth}px)`;
});

Expand Down
2 changes: 1 addition & 1 deletion src/GlobalFooter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default defineComponent({
props: {
links: [Array, Boolean] as PropType<Links>,
copyright: {
type: [Object, Function, Boolean] as PropType<VNodeChild | JSX.Element>,
type: [String, Object, Function, Boolean] as PropType<VNodeChild | JSX.Element>,
default: () => undefined,
},
prefixCls: {
Expand Down
16 changes: 13 additions & 3 deletions src/utils/getMenuData.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import type { RouteRecordRaw } from 'vue-router';

export { clearMenuItem, flatMap, getMenuFirstChildren } from './index';

export type MenuData = {
menuData: RouteRecordRaw[];
breadcrumb: Record<string, any>;
};

const formatRelativePath = (
export const formatRelativePath = (
routes: RouteRecordRaw[],
breadcrumb: Record<string, any>,
parent?: RouteRecordRaw,
Expand All @@ -28,8 +29,17 @@ const formatRelativePath = (
});
};

export const getMenuData = (routes: RouteRecordRaw[]): MenuData => {
const childrenRoute = routes.find(route => route.path === '/');
/**
*
* @param routes all routes
* @param child find first route
* @returns { childrens, breadcrumb }
*/
export const getMenuData = (routes: RouteRecordRaw[], child?: RouteRecordRaw): MenuData => {
const childrenRoute = routes.find(
route =>
(child && (child.name === route.name || child?.path === route.path)) || route.path === '/',
);
const breadcrumb: Record<string, any> = {};
return {
menuData: formatRelativePath(childrenRoute?.children || ([] as RouteRecordRaw[]), breadcrumb),
Expand Down

0 comments on commit f4b995c

Please sign in to comment.