Commit f4b995c0 authored by Sendya's avatar Sendya

fix: copyright prop string type error

parent 9dbbd49c
...@@ -121,6 +121,9 @@ const layoutConf = reactive({ ...@@ -121,6 +121,9 @@ const layoutConf = reactive({
| menuSubItemRender | custom render Menu.SubItem | v-slot#menuSubItemRender="{ item, icon }" \| ({ item, icon }) => VNode | null | | menuSubItemRender | custom render Menu.SubItem | v-slot#menuSubItemRender="{ item, icon }" \| ({ item, icon }) => VNode | null |
| locale | i18n | Function (key: string) => string \| `false` | `false` | | locale | i18n | Function (key: string) => string \| `false` | `false` |
> Menu generation requires `getMenuData` and `clearMenuItem` function
> e.g. `const { menuData } = getMenuData(clearMenuItem(routes))`
### PageContainer ### PageContainer
| Property | Description | Type | Default Value | | Property | Description | Type | Default Value |
......
{ {
"name": "@ant-design-vue/pro-layout", "name": "@ant-design-vue/pro-layout",
"version": "3.1.3", "version": "3.1.4",
"license": "MIT", "license": "MIT",
"files": [ "files": [
"dist" "dist"
......
...@@ -87,7 +87,6 @@ const ProLayout = defineComponent({ ...@@ -87,7 +87,6 @@ const ProLayout = defineComponent({
'menuClick', 'menuClick',
], ],
setup(props, { emit, slots }) { setup(props, { emit, slots }) {
console.log('props', props);
const isTop = computed(() => props.layout === 'top'); const isTop = computed(() => props.layout === 'top');
const hasSide = computed(() => props.layout === 'mix' || props.layout === 'side' || false); const hasSide = computed(() => props.layout === 'mix' || props.layout === 'side' || false);
const hasSplitMenu = computed(() => props.layout === 'mix' && props.splitMenus); const hasSplitMenu = computed(() => props.layout === 'mix' && props.splitMenus);
......
...@@ -42,18 +42,9 @@ const FooterToolbar = defineComponent({ ...@@ -42,18 +42,9 @@ const FooterToolbar = defineComponent({
if (!siderWidth || layout === 'top') { if (!siderWidth || layout === 'top') {
return '100%'; return '100%';
} }
console.log(
'x',
unref(siderWidth),
'hasFlatMenu',
unref(hasFlatMenu),
'hasSide',
unref(context.hasSide),
);
if (!hasFlatMenu.value && !unref(hasSide)) { if (!hasFlatMenu.value && !unref(hasSide)) {
return '100%'; return '100%';
} }
console.log('x2', unref(context.hasSide));
return isMobile ? '100%' : `calc(100% - ${siderWidth}px)`; return isMobile ? '100%' : `calc(100% - ${siderWidth}px)`;
}); });
......
...@@ -23,7 +23,7 @@ export default defineComponent({ ...@@ -23,7 +23,7 @@ export default defineComponent({
props: { props: {
links: [Array, Boolean] as PropType<Links>, links: [Array, Boolean] as PropType<Links>,
copyright: { copyright: {
type: [Object, Function, Boolean] as PropType<VNodeChild | JSX.Element>, type: [String, Object, Function, Boolean] as PropType<VNodeChild | JSX.Element>,
default: () => undefined, default: () => undefined,
}, },
prefixCls: { prefixCls: {
......
import type { RouteRecordRaw } from 'vue-router'; import type { RouteRecordRaw } from 'vue-router';
export { clearMenuItem, flatMap, getMenuFirstChildren } from './index'; export { clearMenuItem, flatMap, getMenuFirstChildren } from './index';
export type MenuData = { export type MenuData = {
...@@ -6,7 +7,7 @@ export type MenuData = { ...@@ -6,7 +7,7 @@ export type MenuData = {
breadcrumb: Record<string, any>; breadcrumb: Record<string, any>;
}; };
const formatRelativePath = ( export const formatRelativePath = (
routes: RouteRecordRaw[], routes: RouteRecordRaw[],
breadcrumb: Record<string, any>, breadcrumb: Record<string, any>,
parent?: RouteRecordRaw, parent?: RouteRecordRaw,
...@@ -28,8 +29,17 @@ const formatRelativePath = ( ...@@ -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> = {}; const breadcrumb: Record<string, any> = {};
return { return {
menuData: formatRelativePath(childrenRoute?.children || ([] as RouteRecordRaw[]), breadcrumb), 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