Skip to content

Commit 7afa332

Browse files
committed
feat(button):添加button分支
1 parent 478f1f4 commit 7afa332

19 files changed

+552
-253
lines changed

.eslintrc

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
"new-cap": 0,
2828
"prefer-destructuring": 0,
2929
"no-underscore-dangle": 0,
30-
"func-style": 0,
31-
"no-console": ["error", { "allow": ["warn", "error"] }],
30+
"func-style": 0
3231
},
3332
"overrides": [
3433
{

.prettierrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"printWidth": 80,
5+
"trailingComma": "none"
6+
}

common

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit ed1cec8b70e8d4e70f49918fa33a8ecd01573b94
1+
Subproject commit 9399e7b7ecd2e396af948a024e20b7cda7f67b43

docs/mobile/app.vue

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<template>
2+
<div id="app">
3+
<div class="spfx-page-doc spfx-wrapper">
4+
<div class="spfx-doc">
5+
<div class="spfx-fixed-side">
6+
<div class="spfx-sidenav">
7+
<div
8+
class="spfx-sidenav-group"
9+
v-for="(item, navIndex) in docs"
10+
:key="navIndex"
11+
>
12+
<span class="spfx-sidenav-group__title">{{ item.title }}</span>
13+
<div class="spfx-sidenav-group__children">
14+
<div
15+
class="spfx-sidenav-item"
16+
v-for="(linkItem, linkIndex) in item.children"
17+
:key="linkIndex"
18+
>
19+
<router-link
20+
class="spfx-main-link spfx-doc-link"
21+
:active-class="'spfx-doc-link--active'"
22+
:to="'/components/' + linkItem.name"
23+
>{{ linkItem.title }}</router-link
24+
>
25+
</div>
26+
</div>
27+
</div>
28+
</div>
29+
</div>
30+
<div class="spfx-doc-content">
31+
<router-view />
32+
</div>
33+
</div>
34+
</div>
35+
</div>
36+
</template>
37+
<script lang="ts">
38+
import config from './mobile.config';
39+
import { ref } from 'vue';
40+
export default {
41+
setup() {
42+
const docs = ref(config.navs.components.docs);
43+
return { docs };
44+
},
45+
};
46+
</script>

docs/mobile/index.html

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8+
<title>TDesign</title>
9+
<!--[if lte IE 9]>
10+
<style>
11+
#app {
12+
display: none;
13+
}
14+
</style>
15+
<![endif]-->
16+
</head>
17+
18+
<body>
19+
<!--[if lte IE 9]>
20+
<h1 style="position: absolute; width: 100%; text-align:center; top: 45%">请使用 IE 10 以及更新版本的浏览器访问,建议使用 <a href="https://www.google.cn/chrome/">Chrome</a></h1>
21+
<![endif]-->
22+
<div id="app">
23+
<app></app>
24+
</div>
25+
</body>
26+
27+
</html>

docs/mobile/main.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { createApp } from 'vue';
2+
import app from './app.vue';
3+
import router from './router';
4+
5+
import TDesign from '@/index';
6+
7+
import '../styles/index.less';
8+
9+
createApp(app)
10+
.use(TDesign)
11+
.use(router)
12+
.component('spfx-demo', import('./components/demo.vue'))
13+
.mount('#app');

docs/mobile/mobile.config.ts

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
export default {
2+
navs: {
3+
components: {
4+
title: '组件',
5+
url: 'components',
6+
docs: [
7+
// {
8+
// title: "开始",
9+
// type: "document", // 普通文档
10+
// children: [
11+
// {
12+
// title: "安装",
13+
// name: "install",
14+
// component: import("@/../docs/install.md")
15+
// },
16+
// {
17+
// title: "更新日志",
18+
// name: "changelog",
19+
// component: () => import("@/../CHANGELOG.md")
20+
// }
21+
// ]
22+
// },
23+
{
24+
title: '基础组件',
25+
type: 'component', // 组件文档
26+
children: [
27+
// {
28+
// title: 'Button 按钮',
29+
// name: 'button',
30+
// component: () => import('@/button/button.md'),
31+
// },
32+
{
33+
title: 'Icon 图标',
34+
name: 'icon',
35+
component: () => import('@/icon/demos/base.vue'),
36+
},
37+
],
38+
},
39+
],
40+
},
41+
},
42+
};

docs/mobile/router.ts

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { RouteRecordRaw, createRouter, createWebHistory } from 'vue-router';
2+
import config from './mobile.config';
3+
4+
// const demoReq = require.context("@/", true, /demos[/\\][\w-]+\.vue$/im);
5+
6+
const navs = config.navs;
7+
8+
function getDocsRoutes(docs: any[], type: string): RouteRecordRaw[] {
9+
let docsRoutes: Array<RouteRecordRaw> = [];
10+
11+
docs.forEach((item) => {
12+
const docType = item.type || type;
13+
if (docType === type) {
14+
if (item.children) {
15+
docsRoutes = docsRoutes.concat(getDocsRoutes(item.children, docType));
16+
} else {
17+
docsRoutes.push({
18+
path: `/components/${item.name}`,
19+
name: item.name,
20+
component: item.component,
21+
});
22+
}
23+
}
24+
});
25+
return docsRoutes;
26+
}
27+
console.log(getDocsRoutes(navs.components.docs, 'component'));
28+
// console.log(import("@/icon/icon.md"))
29+
const routes: Array<RouteRecordRaw> = [
30+
{
31+
path: '/',
32+
redirect: '/components/install',
33+
},
34+
...getDocsRoutes(navs.components.docs, 'component'),
35+
];
36+
const router = createRouter({
37+
history: createWebHistory(process.env.BASE_URL),
38+
routes,
39+
});
40+
41+
export default router;

docs/sites/main.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
import { createApp } from "vue";
2-
import app from "./app.vue";
3-
import router from "./router";
1+
import { createApp } from 'vue';
2+
import app from './app.vue';
3+
import router from './router';
44

5-
import TDesign from "@/index";
5+
import TDesign from '@/index';
6+
7+
import '../../common/style/mobile/index.less';
8+
import '../styles/index.less';
69

7-
import "../styles/index.less";
810

911
createApp(app)
1012
.use(TDesign)
1113
.use(router)
12-
.component("spfx-demo", import("./components/demo.vue"))
13-
.mount("#app");
14+
.component('spfx-demo', import('./components/demo.vue'))
15+
.mount('#app');

docs/sites/router.ts

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { RouteRecordRaw, createRouter, createWebHistory } from "vue-router";
2-
import config from "./sites.config";
1+
import { RouteRecordRaw, createRouter, createWebHistory } from 'vue-router';
2+
import config from './sites.config';
33

44
// const demoReq = require.context("@/", true, /demos[/\\][\w-]+\.vue$/im);
55

@@ -8,7 +8,7 @@ const navs = config.navs;
88
function getDocsRoutes(docs: any[], type: string): RouteRecordRaw[] {
99
let docsRoutes: Array<RouteRecordRaw> = [];
1010

11-
docs.forEach(item => {
11+
docs.forEach((item) => {
1212
const docType = item.type || type;
1313
if (docType === type) {
1414
if (item.children) {
@@ -17,21 +17,20 @@ function getDocsRoutes(docs: any[], type: string): RouteRecordRaw[] {
1717
docsRoutes.push({
1818
path: `/components/${item.name}`,
1919
name: item.name,
20-
component: item.component
20+
component: item.component,
2121
});
2222
}
2323
}
2424
});
2525
return docsRoutes;
2626
}
27-
console.log(getDocsRoutes(navs.components.docs, "component"));
28-
// console.log(import("@/icon/icon.md"))
27+
console.log(getDocsRoutes(navs.components.docs, 'component'));
2928
const routes: Array<RouteRecordRaw> = [
3029
{
31-
path: "/",
32-
redirect: "/components/install"
30+
path: '/',
31+
redirect: '/components/install',
3332
},
34-
...getDocsRoutes(navs.components.docs, "component")
33+
...getDocsRoutes(navs.components.docs, 'component'),
3534
];
3635
const router = createRouter({
3736
history: createWebHistory(process.env.BASE_URL),

docs/sites/sites.config.ts

+18-13
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
export default {
22
navs: {
33
components: {
4-
title: "组件",
5-
url: "components",
4+
title: '组件',
5+
url: 'components',
66
docs: [
77
// {
88
// title: "开始",
@@ -21,22 +21,27 @@ export default {
2121
// ]
2222
// },
2323
{
24-
title: "基础组件",
25-
type: "component", // 组件文档
24+
title: '基础组件',
25+
type: 'component', // 组件文档
2626
children: [
2727
// {
2828
// title: 'Button 按钮',
2929
// name: 'button',
3030
// component: () => import('@/button/button.md'),
3131
// },
3232
{
33-
title: "Icon 图标",
34-
name: "icon",
35-
component: () => import("@/icon/demos/base.vue")
36-
}
37-
]
38-
}
39-
]
40-
}
41-
}
33+
title: 'Icon',
34+
name: 'icon',
35+
component: () => import('@/icon/demos/base.vue'),
36+
},
37+
{
38+
title: 'Button',
39+
name: 'button',
40+
component: () => import('@/button/demos/base.vue'),
41+
},
42+
],
43+
},
44+
],
45+
},
46+
},
4247
};

docs/styles/vars.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@prefix: td;
1+
@prefix: t;
22
@primary-color: #0052d9;
33

44
@primary-color-darken-1: darken(@primary-color, (43 - 35) * 1%);

modules.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
declare module "*.md" {
1+
declare module '*.md' {
22
const content: string;
33
export default content;
44
}
55

6-
declare module "*.json" {
6+
declare module '*.json' {
77
const content: string;
88
export default content;
99
}
1010

11-
declare module 'clipboard';
11+
declare module 'clipboard';

0 commit comments

Comments
 (0)