Commit ac911538 authored by Sendya's avatar Sendya

fix: footerRender, GlobalFooter props check

parent 5f70ec85
......@@ -28,9 +28,11 @@
<!-- custom breadcrumb itemRender -->
<template #breadcrumbRender="{ route, params, routes }">
<span v-if="routes.indexOf(route) === routes.length - 1">
<SmileOutlined />
{{ route.breadcrumbName }}
</span>
<router-link v-else :to="{ path: route.path, params }">
<SmileOutlined />
{{ route.breadcrumbName }}
</router-link>
</template>
......@@ -54,29 +56,15 @@
<!-- content begin -->
<router-view />
<!-- content end -->
<FooterToolbar>
<a-space>
<span :disabled="state.layout !== 'mix'">
<span style="margin-right: 8px">SplitMenus:</span>
<a-switch
v-model:checked="state.splitMenus"
:disabled="state.layout !== 'mix'"
checked-children="ON"
un-checked-children="OFF"
/>
</span>
<a-button @click="handlePageLoadingClick">Page Loading</a-button>
<a-select v-model:value="state.navTheme" style="width: 100px">
<a-select-option value="light">Light</a-select-option>
<a-select-option value="dark">Dark</a-select-option>
</a-select>
<a-select v-model:value="state.layout" style="width: 100px">
<a-select-option value="side">Side</a-select-option>
<a-select-option value="top">Top</a-select-option>
<a-select-option value="mix">Mix</a-select-option>
</a-select>
</a-space>
</FooterToolbar>
<template #footerRender>
<GlobalFooter
:links="[
{ key: 'a link', title: 'Link1', href: 'http://www.baidu.com/', blankTarget: true },
{ key: 'b link', title: 'Link2', href: 'https://www.google.com/', blankTarget: true },
]"
copyright="2021 &copy; Sendya"
></GlobalFooter>
</template>
</pro-layout>
</template>
......@@ -84,7 +72,13 @@
import { computed, defineComponent, reactive, ref, watchEffect } from 'vue';
import { useRouter } from 'vue-router';
import { Button, Switch, Select, Space, Badge, Menu } from 'ant-design-vue';
import { getMenuData, clearMenuItem, FooterToolbar } from '@ant-design-vue/pro-layout';
import {
getMenuData,
clearMenuItem,
FooterToolbar,
GlobalFooter,
} from '@ant-design-vue/pro-layout';
import { SmileOutlined } from '@ant-design/icons-vue';
import type { RouteContextProps } from '@ant-design-vue/pro-layout';
const i18n = (t: string) => t;
......@@ -101,6 +95,9 @@ export default defineComponent({
[Badge.name]: Badge,
[Menu.Item.name]: Menu.Item,
GlobalFooter,
SmileOutlined,
},
setup() {
const loading = ref(false);
......
import { createRouter, createWebHistory } from 'vue-router';
import type { RouteRecordRaw } from 'vue-router';
import BasicLayout from './layouts/BasicLayout.vue';
import BasicLayout from './layouts/CustomLayout.vue';
import RouteView from './layouts/RouteView.vue';
const routes: RouteRecordRaw[] = [
......
{
"name": "@ant-design-vue/pro-layout",
"version": "3.1.2",
"version": "3.1.3",
"license": "MIT",
"files": [
"dist"
......
This diff is collapsed.
......@@ -22,7 +22,10 @@ export default defineComponent({
name: 'GlobalFooter',
props: {
links: [Array, Boolean] as PropType<Links>,
copyright: [Object, Function] as PropType<VNodeChild | JSX.Element>,
copyright: {
type: [Object, Function, Boolean] as PropType<VNodeChild | JSX.Element>,
default: () => undefined,
},
prefixCls: {
type: String,
default: 'ant-pro',
......@@ -35,7 +38,8 @@ export default defineComponent({
(Array.isArray(props.links) && props.links.length === 0)) &&
(props.copyright == null || props.copyright === false)
) {
return null;
console.warn('[pro-layout]: GlobalFooter required `links` or `copyright`');
return () => null;
}
const baseClassName = `${props.prefixCls}-global-footer`;
......
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