Skip to content

Commit ac99e81

Browse files
committed
build: 3.0.3
1 parent 5443a32 commit ac99e81

File tree

3 files changed

+40
-56
lines changed

3 files changed

+40
-56
lines changed

README.md

Lines changed: 38 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ Ant Design Pro Layout
44

55
<div align="center">
66

7-
[![NPM version](https://img.shields.io/npm/v/@ant-design-vue/pro-layout/next?style=flat)](https://npmjs.org/package/@ant-design-vue/pro-layout)
8-
[![Vue Support](https://img.shields.io/badge/support-Vue3-green?style=flat)](./package.json)
9-
[![Vue Grammar Level](https://img.shields.io/badge/full-Composition%20API-blue?style=flat)](https://v3.vuejs.org/guide/composition-api-introduction.html)
10-
[![NPM downloads](http://img.shields.io/npm/dm/@ant-design-vue/pro-layout.svg?style=flat)](https://npmjs.org/package/@ant-design-vue/pro-layout)
11-
[![License](https://img.shields.io/github/license/vueComponent/pro-layout)](./LICENSE)
7+
[![NPM version](https://img.shields.io/npm/v/@ant-design-vue/pro-layout/next?style=flat)](https://npmjs.org/package/@ant-design-vue/pro-layout) [![Vue Support](https://img.shields.io/badge/support-Vue3-green?style=flat)](./package.json) [![Vue Grammar Level](https://img.shields.io/badge/full-Composition%20API-blue?style=flat)](https://v3.vuejs.org/guide/composition-api-introduction.html) [![NPM downloads](http://img.shields.io/npm/dm/@ant-design-vue/pro-layout.svg?style=flat)](https://npmjs.org/package/@ant-design-vue/pro-layout) [![License](https://img.shields.io/github/license/vueComponent/pro-layout)](./LICENSE)
128

139
</div>
1410

@@ -26,32 +22,25 @@ npm i @ant-design-vue/pro-layout@next -S
2622
First, you should add the icons that you need into the library.
2723

2824
```js
29-
import { createApp } from 'vue'
25+
import { createApp } from 'vue';
3026
import ProLayout, { PageContainer } from '@ant-design-vue/pro-layout';
3127

3228
const app = createApp();
3329

34-
app.use(ProLayout)
35-
.use(PageContainer)
36-
.mount('#app')
30+
app.use(ProLayout).use(PageContainer).mount('#app');
3731
```
3832

3933
After that, you can use pro-layout in your Vue components as simply as this:
4034

4135
```vue
4236
<template>
43-
<route-context-provider :value="state">
44-
<pro-layout>
45-
<router-view />
46-
</pro-layout>
47-
</route-context-provider>
37+
<pro-layout v-bind="state">
38+
<router-view />
39+
</pro-layout>
4840
</template>
4941
5042
<script>
5143
import { defineComponent, reactive } from 'vue';
52-
import { createRouteContext } from '@ant-design-vue/pro-layout';
53-
54-
const [ RouteContextProvider ] = createRouteContext();
5544
5645
export default defineComponent({
5746
setup() {
@@ -69,56 +58,51 @@ export default defineComponent({
6958
hasSideMenu: true,
7059
hasHeader: true,
7160
hasFooterToolbar: false,
72-
setHasFooterToolbar: (has) => (state.hasFooterToolbar = has),
61+
setHasFooterToolbar: has => (state.hasFooterToolbar = has),
7362
});
74-
63+
7564
return {
7665
state,
77-
}
66+
};
7867
},
79-
components: {
80-
RouteContextProvider,
81-
}
8268
});
8369
</script>
8470
```
71+
8572
or `TSX`
73+
8674
```tsx
8775
import { defineComponent, reactive } from 'vue';
88-
import ProLayout, { createRouteContext, RouteContextProps } from '@ant-design-vue/pro-layout';
76+
import { RouterView } from 'vue-router';
77+
import ProLayout from '@ant-design-vue/pro-layout';
8978

9079
export default defineComponent({
91-
setup () {
92-
const [ RouteContextProvider ] = createRouteContext();
93-
94-
const state = reactive<RouteContextProps>({
95-
collapsed: false,
96-
97-
openKeys: ['/dashboard'],
98-
selectedKeys: ['/welcome'],
99-
100-
isMobile: false,
101-
fixSiderbar: false,
102-
fixedHeader: false,
103-
menuData: [],
104-
sideWidth: 208,
105-
hasSideMenu: true,
106-
hasHeader: true,
107-
hasFooterToolbar: false,
108-
setHasFooterToolbar: (has: boolean) => (state.hasFooterToolbar = has),
109-
});
110-
111-
return () => (
112-
<RouteContextProvider value={state}>
113-
<ProLayout>
114-
<RouterView />
115-
</ProLayout>
116-
</RouteContextProvider>
117-
)
118-
}
119-
})
120-
```
80+
setup() {
81+
const state = reactive({
82+
collapsed: false,
83+
84+
openKeys: ['/dashboard'],
85+
selectedKeys: ['/welcome'],
86+
87+
isMobile: false,
88+
fixSiderbar: false,
89+
fixedHeader: false,
90+
menuData: [],
91+
sideWidth: 208,
92+
hasSideMenu: true,
93+
hasHeader: true,
94+
hasFooterToolbar: false,
95+
setHasFooterToolbar: (has: boolean) => (state.hasFooterToolbar = has),
96+
});
12197

98+
return () => (
99+
<ProLayout {...state} locale={(i18n: string) => i18n}>
100+
<RouterView />
101+
</ProLayout>
102+
);
103+
},
104+
});
105+
```
122106

123107
## Build project
124108

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ant-design-vue/pro-layout",
3-
"version": "3.0.0-beta.2",
3+
"version": "3.0.0-beta.3",
44
"main": "./lib/index.js",
55
"module": "./es/index.js",
66
"repository": {

src/hooks/useMenu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,5 @@ export function useMenu({ collapsed = false, openKeys = [], selectedKeys = [] }:
7070
}
7171

7272
export function useMenuState(): Readonly<ToRefs<MenuStated>> & MenuHandles {
73-
return inject(MenuStateKey);
73+
return inject(MenuStateKey) as any;
7474
}

0 commit comments

Comments
 (0)