Commit 062f5647 authored by Sendya's avatar Sendya

fix: style

parent 824e9b8b
...@@ -15,7 +15,7 @@ const BaseMenuDemo = { ...@@ -15,7 +15,7 @@ const BaseMenuDemo = {
themeChecked: true, themeChecked: true,
modeChecked: true, modeChecked: true,
}) })
const { state: menuState } = useMenuState({ const [menuState] = useMenuState({
collapsed: false, collapsed: false,
openKeys: ['/dashboard'] as string[], openKeys: ['/dashboard'] as string[],
selectedKeys: ['/dashboard/monitor'] as string[], selectedKeys: ['/dashboard/monitor'] as string[],
......
...@@ -11,7 +11,7 @@ const BasicLayout = defineComponent({ ...@@ -11,7 +11,7 @@ const BasicLayout = defineComponent({
name: 'BasicLayout', name: 'BasicLayout',
inheritAttrs: false, inheritAttrs: false,
setup(_, { slots, attrs }) { setup(_, { slots, attrs }) {
const { state: menuState } = useMenuState({ const [menuState] = useMenuState({
collapsed: false, collapsed: false,
openKeys: [], openKeys: [],
selectedKeys: ['/welcome'], selectedKeys: ['/welcome'],
......
import { createApp, defineComponent, reactive } from 'vue'; import { createApp, defineComponent, reactive } from 'vue';
import 'ant-design-vue/dist/antd.less'; import 'ant-design-vue/dist/antd.less';
import { Button, Descriptions, Space, Statistic, Tabs } from 'ant-design-vue'; import { Button, Descriptions, Space, Statistic, Tag, message } from 'ant-design-vue';
import { PageContainer } from '../src/PageContainer'; import { PageContainer } from '../src/PageContainer';
import { default as ProProvider } from '../src/ProProvider'; import { default as ProProvider } from '../src/ProProvider';
import { createRouteContext } from '../src/RouteContext'; import { createRouteContext } from '../src/RouteContext';
import { LikeOutlined } from '@ant-design/icons-vue'; import { LikeOutlined } from '@ant-design/icons-vue';
import './index.less';
const { Item: DescriptionsItem } = Descriptions;
const App = defineComponent({ const App = defineComponent({
name: 'App', name: 'App',
...@@ -37,56 +36,62 @@ const App = defineComponent({ ...@@ -37,56 +36,62 @@ const App = defineComponent({
}); });
return () => ( return () => (
<div> <div class="demo-page-box" style="padding: 20px; background: #ccc;">
<ProProvider prefixCls={'ant-pro'} contentWidth={'Fixed'}> <ProProvider prefixCls={'ant-pro'} contentWidth={'Fixed'}>
<RouteContextProvider> <RouteContextProvider>
<PageContainer <div style="background: #fff; height: 500px;">
title="Title" <PageContainer
subTitle="This is a subtitle" title="Title"
breadcrumb={{ routes }} subTitle="This is a subtitle"
onBack={() => null} breadcrumb={{ routes }}
extra={[ onBack={() => message.info('@back click')}
<Button key="3">操作</Button>, tags={['Tag 1', 'Tag 2'].map(tag => (<Tag color="blue">{tag}</Tag>))}
<Button key="2">操作</Button>, extra={[
<Button key="1" type="primary"> <Button key="3">操作</Button>,
主操作 <Button key="2">操作</Button>,
</Button>, <Button key="1" type="primary">
]} 主操作
content={ </Button>,
<Descriptions size="small" column={2}> ]}
<Descriptions.Item label="创建人">张三</Descriptions.Item> content={
<Descriptions.Item label="联系方式"> <Descriptions size="small" column={{ md: 2 }}>
<a>421421</a> <Descriptions.Item label="创建人">张三</Descriptions.Item>
</Descriptions.Item> <Descriptions.Item label="联系方式">
<Descriptions.Item label="创建时间">2017-01-10</Descriptions.Item> <a>421421</a>
<Descriptions.Item label="更新时间">2017-10-10</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label="备注">中国浙江省杭州市西湖区古翠路</Descriptions.Item> <Descriptions.Item label="创建时间">2017-01-10</Descriptions.Item>
</Descriptions> <Descriptions.Item label="更新时间">2017-10-10</Descriptions.Item>
} <Descriptions.Item label="备注">中国浙江省杭州市西湖区古翠路</Descriptions.Item>
extraContent={ </Descriptions>
<Space size={24}> }
<Statistic title="Feedback" value={1128} prefix={<LikeOutlined />} /> extraContent={
<Statistic title="Unmerged" value={93} suffix="/ 100" /> <Space size={24}>
</Space> <Statistic title="Feedback" value={1128} prefix={<LikeOutlined />} />
} <Statistic title="Unmerged" value={93} suffix="/ 100" />
tabList={[ </Space>
{ key: '1', tab: 'Details' }, }
{ key: '2', tab: 'Rule' }, tabList={[
]} { key: '1', tab: 'Details' },
tabActiveKey={state.tabActiveKey} { key: '2', tab: 'Rule' },
onTabChange={(key: string) => { ]}
console.log('onTabChange', key); tabProps={{
state.tabActiveKey = key; type: 'card',
}} }}
footer={[ tabActiveKey={state.tabActiveKey}
<Button key="3">重置</Button>, onTabChange={(key: string) => {
<Button key="2" type="primary"> console.log('onTabChange', key);
提交 state.tabActiveKey = key;
</Button>, }}
]} footer={[
> <Button key="3">重置</Button>,
<div>Page Content</div> <Button key="2" type="primary">
</PageContainer> 提交
</Button>,
]}
>
<div>Page Content</div>
</PageContainer>
</div>
</RouteContextProvider> </RouteContextProvider>
</ProProvider> </ProProvider>
</div> </div>
......
...@@ -10,7 +10,7 @@ import * as Icon from '@ant-design/icons-vue'; ...@@ -10,7 +10,7 @@ import * as Icon from '@ant-design/icons-vue';
const DemoComponent = { const DemoComponent = {
setup() { setup() {
const { state: menuState } = useMenuState({ const [menuState] = useMenuState({
collapsed: false, collapsed: false,
openKeys: [''], openKeys: [''],
selectedKeys: ['/welcome'], selectedKeys: ['/welcome'],
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
@pro-layout-page-container: ~'@{ant-prefix}-pro-page-container'; @pro-layout-page-container: ~'@{ant-prefix}-pro-page-container';
.@{pro-layout-page-container}-children-content { .@{pro-layout-page-container}-children-content {
margin: 24px 24px 0; margin: 24px 24px 0;
} }
...@@ -13,11 +14,19 @@ ...@@ -13,11 +14,19 @@
margin: 0; margin: 0;
} }
// fix antd@4 upgrade PageHeader style. // fix antd@4 upgrade PageHeader style.
.ant-page-header-heading { .@{ant-prefix}-page-header-heading {
.ant-page-header-heading-title,.ant-page-header-heading-extra { .@{ant-prefix}-page-header-back {
margin: 12px 0;
margin-right: 16px;
}
.@{ant-prefix}-page-header-heading-title,
.@{ant-prefix}-page-header-heading-extra {
margin: 4px 0; margin: 4px 0;
} }
.ant-page-header-heading-sub-title { .@{ant-prefix}-page-header-heading-sub-title {
margin: 9px 12px 9px 0;
}
.@{ant-prefix}-page-header-heading-tags {
margin: 9px 0; margin: 9px 0;
} }
} }
......
...@@ -78,6 +78,7 @@ const renderFooter = ( ...@@ -78,6 +78,7 @@ const renderFooter = (
tabProps, tabProps,
prefixedClassName, prefixedClassName,
} = props; } = props;
console.log('tabProps', tabProps);
if (tabList && tabList.length) { if (tabList && tabList.length) {
return ( return (
<Tabs <Tabs
......
import { VNodeChild, CSSProperties } from 'vue'; import { VNodeChild, CSSProperties } from 'vue';
export type TabBarType = 'line' | 'card' | 'editable-card';
export type TabSize = 'default' | 'large' | 'small';
export type TabPosition = 'left' | 'right';
export type TabBarExtraPosition = TabPosition;
export type TabBarExtraMap = Partial<Record<TabBarExtraPosition, VNodeChild>>;
export type TabBarExtraContent = VNodeChild | TabBarExtraMap;
export interface TabsProps { export interface TabsProps {
prefixCls?: string; prefixCls?: string;
class?: string | string[]; class?: string | string[];
...@@ -7,10 +16,11 @@ export interface TabsProps { ...@@ -7,10 +16,11 @@ export interface TabsProps {
id?: string; id?: string;
activeKey?: string; activeKey?: string;
hideAdd?: boolean;
// Unchangeable
// size?: TabSize;
tabBarStyle?: CSSProperties;
tabPosition?: TabPosition;
type?: TabBarType;
tabBarGutter?: number;
} }
export type TabBarExtraPosition = 'left' | 'right';
export type TabBarExtraMap = Partial<Record<TabBarExtraPosition, VNodeChild>>;
export type TabBarExtraContent = VNodeChild | TabBarExtraMap;
...@@ -42,10 +42,7 @@ interface MenuStated { ...@@ -42,10 +42,7 @@ interface MenuStated {
openKeys: string[]; openKeys: string[];
} }
export interface MenuStateWatched { export type MenuStateWatched = [state: MenuStated, watchRef: WatchStopHandle]
state: MenuStated;
watchRef: WatchStopHandle;
}
export function useMenuState({ export function useMenuState({
collapsed = false, collapsed = false,
...@@ -71,10 +68,7 @@ export function useMenuState({ ...@@ -71,10 +68,7 @@ export function useMenuState({
}, },
); );
return { return [state, watchRef]
state,
watchRef,
};
} }
export function useRootSubmenuKeys(menus: RouteProps[]): ComputedRef<string[]> { export function useRootSubmenuKeys(menus: RouteProps[]): ComputedRef<string[]> {
......
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