Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pro-layout
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
packages
pro-layout
Commits
8a8fc81d
Commit
8a8fc81d
authored
Dec 16, 2020
by
Sendya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: demo
parent
a7380c6b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
13 deletions
+76
-13
README.md
README.md
+72
-9
demoBox.tsx
examples/demoBox.tsx
+1
-1
index.tsx
examples/index.tsx
+3
-3
No files found.
README.md
View file @
8a8fc81d
...
...
@@ -37,22 +37,86 @@ After that, you can use pro-layout in your Vue components as simply as this:
```
vue
<
template
>
<route-context-provider
:value=
"state"
>
<pro-layout>
<router-view
/>
<router-view
/>
</pro-layout>
</route-context-provider>
</
template
>
<
script
>
import
{
defineComponent
,
reactive
}
from
'vue'
;
import
ProLayout
,
{
createRouteContext
}
from
'@ant-design-vue/pro-layout'
;
const
[
RouteContextProvider
]
=
createRouteContext
();
export
default
defineComponent
({
setup
()
{
const
state
=
reactive
({
collapsed
:
false
,
openKeys
:
[
'/dashboard'
],
setOpenKeys
:
(
keys
)
=>
(
state
.
openKeys
=
keys
),
selectedKeys
:
[
'/welcome'
],
setSelectedKeys
:
(
keys
)
=>
(
state
.
selectedKeys
=
keys
),
isMobile
:
false
,
fixSiderbar
:
false
,
fixedHeader
:
false
,
menuData
:
[],
sideWidth
:
208
,
hasSideMenu
:
true
,
hasHeader
:
true
,
hasFooterToolbar
:
false
,
setHasFooterToolbar
:
(
has
)
=>
(
state
.
hasFooterToolbar
=
has
),
});
return
{
state
,
}
},
components
:
{
ProLayout
,
RouteContextProvider
,
}
});
</
script
>
```
or
`TSX`
```
jsx
import
ProLayout
from
'@ant-design-vue/pro-layout'
```
tsx
import
{
defineComponent
,
reactive
}
from
'vue'
;
import
ProLayout
,
{
createRouteContext
,
RouteContextProps
}
from
'@ant-design-vue/pro-layout'
;
export
default
defineComponent
({
setup
()
{
return
():
JSX
.
Element
=>
(
<
ProLayout
>
<
RouterView
/>
</
ProLayout
>
)
const
[
RouteContextProvider
]
=
createRouteContext
();
const
state
=
reactive
<
RouteContextProps
>
({
collapsed
:
false
,
openKeys
:
[
'/dashboard'
],
setOpenKeys
:
(
keys
:
string
[])
=>
(
state
.
openKeys
=
keys
),
selectedKeys
:
[
'/welcome'
],
setSelectedKeys
:
(
keys
:
string
[])
=>
(
state
.
selectedKeys
=
keys
),
isMobile
:
false
,
fixSiderbar
:
false
,
fixedHeader
:
false
,
menuData
:
[],
sideWidth
:
208
,
hasSideMenu
:
true
,
hasHeader
:
true
,
hasFooterToolbar
:
false
,
setHasFooterToolbar
:
(
has
:
boolean
)
=>
(
state
.
hasFooterToolbar
=
has
),
});
return
()
=>
(
<
RouteContextProvider
value=
{
state
}
>
<
ProLayout
>
<
RouterView
/>
</
ProLayout
>
</
RouteContextProvider
>
)
}
})
```
...
...
@@ -61,7 +125,6 @@ export default defineComponent({
## Build project
```
bash
npm run generate
# Generate files to ./src
npm run compile
# Build library
npm run
test
# Runing Test
```
examples/demoBox.tsx
View file @
8a8fc81d
...
...
@@ -28,7 +28,7 @@ export const DemoBox = defineComponent({
const
box
=
createApp
({
render
()
{
return
children
;
return
h
(
'div'
,
children
)
;
},
}).
use
(
RouterLink
);
...
...
examples/index.tsx
View file @
8a8fc81d
...
...
@@ -58,7 +58,7 @@ const BasicLayout = defineComponent({
fixedHeader=
{
state
.
fixedHeader
}
contentWidth=
{
'Fixed'
}
primaryColor=
{
'#1890ff'
}
contentStyle=
{
{
minHeight
:
'
2
00px'
}
}
contentStyle=
{
{
minHeight
:
'
3
00px'
}
}
siderWidth=
{
state
.
sideWidth
}
v
-
slots=
{
{
rightContentRender
:
()
=>
(
...
...
@@ -92,9 +92,9 @@ const SimpleDemo = {
return
()
=>
(
<
div
class=
"components"
>
<
h2
>
# BasicLayout
</
h2
>
<
DemoBox
>
<
div
>
<
BasicLayout
/>
</
DemoBox
>
</
div
>
</
div
>
);
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment