Commit f4b995c0 authored by Sendya's avatar Sendya

fix: copyright prop string type error

parent 9dbbd49c
......@@ -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 |
......
{
"name": "@ant-design-vue/pro-layout",
"version": "3.1.3",
"version": "3.1.4",
"license": "MIT",
"files": [
"dist"
......
......@@ -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);
......
......@@ -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)`;
});
......
......@@ -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: {
......
import type { RouteRecordRaw } from 'vue-router';
export { clearMenuItem, flatMap, getMenuFirstChildren } from './index';
export type MenuData = {
......@@ -6,7 +7,7 @@ export type MenuData = {
breadcrumb: Record<string, any>;
};
const formatRelativePath = (
export const formatRelativePath = (
routes: RouteRecordRaw[],
breadcrumb: Record<string, any>,
parent?: RouteRecordRaw,
......@@ -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),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment