Skip to content

Commit 366fe64

Browse files
committed
feat(route): add route demo
1 parent 5dcdecb commit 366fe64

File tree

7 files changed

+57
-4
lines changed

7 files changed

+57
-4
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { defineComponent } from 'vue'
2+
3+
export default defineComponent({
4+
name: 'd-accordion-demo',
5+
props: {
6+
},
7+
setup(props, ctx) {
8+
return () => {
9+
return <div>devui-accordion-demo</div>
10+
}
11+
}
12+
})
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import AccordionDemoComponent from './accordion-demo'
2+
import DevUIApiComponent from '../../shared/devui-api/devui-api'
3+
4+
const routes = [
5+
{ path: '', redirectTo: 'demo' },
6+
{ path: 'demo', component: AccordionDemoComponent},
7+
{ path: 'api', component: DevUIApiComponent, meta: {
8+
'zh-cn': '../doc/api-cn.md',
9+
'en-us': '../doc/api-en.md'
10+
}}
11+
]
12+
13+
export default routes

devui/button/demo/button.route.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import ButtonDemoComponent from './button-demo.vue'
2+
import DevUIApiComponent from '../../shared/devui-api/devui-api'
3+
4+
const routes = [
5+
{ path: '', redirectTo: 'demo' },
6+
{ path: 'demo', component: ButtonDemoComponent},
7+
{ path: 'api', component: DevUIApiComponent, meta: {
8+
'zh-cn': '../doc/api-cn.md',
9+
'en-us': '../doc/api-en.md'
10+
}}
11+
]
12+
13+
export default routes

devui/shared/devui-api/devui-api.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { defineComponent } from 'vue'
2+
3+
export default defineComponent({
4+
name: 'd-api',
5+
props: {
6+
},
7+
setup(props, ctx) {
8+
return () => {
9+
return <div>devui-api</div>
10+
}
11+
}
12+
})

src/components/app-content.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export default {
7878
if (item.meta.name) {
7979
return {
8080
title: item.meta.name + ' ' + item.meta.cnName,
81-
link: item.path,
81+
link: '/components/' + item.path + '/demo',
8282
};
8383
} else {
8484
return {};

src/components/app-demo-cell.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<div class="examples-viewer">
1717
<div class="examples-viewer-wrapper">
1818
<!-- TODO: Demo列表 -->
19-
<d-button-demo></d-button-demo>
19+
<router-view></router-view>
2020
</div>
2121
</div>
2222
</div>

src/components/component.route.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import GetStartedComponent from './app-demo-cell.vue';
33
import ColorComponent from './app-demo-cell.vue';
44
import ThemeGuideComponent from './app-demo-cell.vue';
55

6+
import accordionRoutes from '../../devui/accordion/demo/accordion.route'
7+
import buttonRoutes from '../../devui/button/demo/button.route'
8+
69
export const routesConfig = [
710
{
811
path: '',
@@ -28,7 +31,7 @@ export const routesConfig = [
2831
{
2932
path: 'accordion',
3033
component: ExamplePanelComponent,
31-
34+
children: accordionRoutes,
3235
meta: {
3336
type: '导航',
3437
enType: 'Navigation',
@@ -118,7 +121,7 @@ export const routesConfig = [
118121
{
119122
path: 'button',
120123
component: ExamplePanelComponent,
121-
124+
children: buttonRoutes,
122125
meta: {
123126
name: 'Button',
124127
cnName: '按钮',

0 commit comments

Comments
 (0)