Skip to content

Commit 0de7bf0

Browse files
authored
Merge branch 'main' into refactor/theme
2 parents a766d94 + e4e5736 commit 0de7bf0

File tree

11 files changed

+129
-46
lines changed

11 files changed

+129
-46
lines changed

.github/.pr-comment-ci-whitelist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ RSS1102
1717
RylanBot
1818
Wesley-0808
1919
zydemail
20+
novlan1

docs/contact.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ We prefer to solve and discuss in the repository, as this allows more people wit
1515
- [TDesign for React](https://github.com/Tencent/tdesign-react)
1616
- [TDesign for WeChat Miniprogram](https://github.com/Tencent/tdesign-miniprogram)
1717
- [TDesign for Mobile Vue](https://github.com/Tencent/tdesign-mobile-vue)
18+
- [TDesign for Mobile React](https://github.com/Tencent/tdesign-mobile-react)
1819
- [TDesign for Flutter](https://github.com/Tencent/tdesign-flutter)
1920

2021
### TDesign User Group in WeCom

docs/contact_zh-CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ title: 联系我们
1515
- [TDesign for React](https://github.com/Tencent/tdesign-react)
1616
- [TDesign for WeChat Miniprogram](https://github.com/Tencent/tdesign-miniprogram)
1717
- [TDesign for Mobile Vue](https://github.com/Tencent/tdesign-mobile-vue)
18+
- [TDesign for Mobile React](https://github.com/Tencent/tdesign-mobile-react)
1819
- [TDesign for Flutter](https://github.com/Tencent/tdesign-flutter)
1920

2021
### 企业微信群

packages/components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tdesign-site-components",
3-
"version": "0.16.6",
3+
"version": "0.16.7",
44
"main": "lib/site.es.js",
55
"scripts": {
66
"dev": "vite",
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import { html, define } from 'hybrids';
1+
import { define, html } from 'hybrids';
22
import style from './style.less';
33

44
export default define({
55
tag: 'td-code',
66
text: '',
7-
render: ({ text }) => html`
8-
<code class="TDesign-code">${text}</code>
9-
`.css`${style}`,
7+
render: ({ text }) => html`<code class="TDesign-code">${text}</code>`.css`${style}`,
108
});

packages/components/src/components/td-doc-header/index.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export default define({
8888
const { scrollTop } = document.documentElement;
8989
// 吸顶效果
9090
const background = shadowRoot.querySelector('.TDesign-doc-header__background') || { style: {} };
91+
const changelogEntry = shadowRoot.querySelector('#TDesign-doc-changelog__entry') || { style: {} };
9192
const title = shadowRoot.querySelector('.TDesign-doc-header__info-title') || { style: {} };
9293
const describe = shadowRoot.querySelector('.TDesign-doc-header__info-describe') || { style: {} };
9394
const thumb = shadowRoot.querySelector('.TDesign-doc-header__thumb') || { style: {} };
@@ -108,6 +109,7 @@ export default define({
108109
opacity: 1,
109110
visibility: 'visible',
110111
});
112+
Object.assign(changelogEntry.style, { opacity: 1, visibility: 'visible' });
111113
Object.assign(background.style, { position: 'fixed', top: '0', left: asideWidth });
112114
tabs &&
113115
Object.assign(tabs.style, {
@@ -120,6 +122,7 @@ export default define({
120122
} else if (scrollTop > 192 && scrollTop < 228) {
121123
if (title.style.visibility !== 'hidden') {
122124
Object.assign(title.style, { opacity: 0, visibility: 'hidden' });
125+
Object.assign(changelogEntry.style, { opacity: 0, visibility: 'hidden' });
123126
Object.assign(thumb.style, { opacity: 0, visibility: 'hidden' });
124127
Object.assign(describe.style, { opacity: 0, visibility: 'hidden' });
125128

@@ -135,6 +138,7 @@ export default define({
135138
opacity: 1,
136139
visibility: 'visible',
137140
});
141+
Object.assign(changelogEntry.style, { opacity: 1, visibility: 'visible' });
138142
Object.assign(describe.style, { opacity: 1, visibility: 'visible' });
139143
Object.assign(background.style, { position: 'absolute', top: 'unset', left: '0' });
140144
tabs && Object.assign(tabs.style, { position: 'absolute', top: '228px' });
@@ -157,8 +161,13 @@ export default define({
157161
};
158162
},
159163
},
164+
showIssue: {
165+
get: (_host, lastValue) => parseBoolean(lastValue, true),
166+
set: (_host, value) => parseBoolean(value, true),
167+
},
168+
160169
render: (host) => {
161-
const { changelog, docInfo, spline } = host;
170+
const { changelog, docInfo, spline, showIssue } = host;
162171
const mobileBodyStyle = { ...host.mobileBodyStyle };
163172
const splineUrl = splineConfig[spline];
164173
const isChangelogComponentRegistered = customElements.get('td-doc-changelog'); // 检查td-doc-changelog组件是否已注册
@@ -208,7 +217,7 @@ export default define({
208217
</div>
209218
</div>
210219
<div class="TDesign-doc-header__background"></div>
211-
<td-doc-issue></td-doc-issue>
220+
${showIssue ? html`<td-doc-issue />` : html``}
212221
`.css`${style}`;
213222
},
214223
});

packages/components/src/styles/docs.less

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ div[name="DESIGN"] {
8383
}
8484

8585
> :first-child {
86-
margin-top: 0;
86+
margin-top: 0;
8787
}
8888

8989
pre {
@@ -105,13 +105,13 @@ div[name="DESIGN"] {
105105
&::-webkit-scrollbar-corner {
106106
width: 0;
107107
}
108-
108+
109109
&::-webkit-scrollbar {
110110
width: 12px;
111111
height: 12px;
112112
background-color: transparent;
113113
}
114-
114+
115115
&::-webkit-scrollbar-thumb {
116116
border-radius: 6px;
117117
border: 4px solid transparent;
@@ -153,7 +153,7 @@ div[name="DESIGN"] {
153153
thead {
154154
background: var(--bg-color-tag);
155155
font-weight: normal;
156-
156+
157157
th {
158158
border: 0;
159159
}
@@ -229,6 +229,7 @@ div[name="DESIGN"] {
229229
margin: 48px 0 8px;
230230
display: flex;
231231
align-items: center;
232+
white-space: pre-wrap;
232233

233234
.title-link(24px, 24px);
234235
}
@@ -308,7 +309,7 @@ div[name="DESIGN"] {
308309
background-clip: content-box;
309310
background-color: var(--bg-color-scroll);
310311
}
311-
312+
312313
.tdesign-toc_list {
313314
padding-left: 0;
314315
font-size: 12px;
@@ -326,7 +327,7 @@ div[name="DESIGN"] {
326327
text-indent: 16px;
327328
}
328329
}
329-
330+
330331
.tdesign-toc_list_item_a {
331332
text-decoration: none;
332333
margin-left: -1px;
@@ -339,11 +340,11 @@ div[name="DESIGN"] {
339340
white-space: nowrap;
340341
text-overflow: ellipsis;
341342
border-left: 1px solid transparent;
342-
343+
343344
&:hover {
344345
color: var(--text-primary);
345346
}
346-
347+
347348
&.active {
348349
color: var(--brand-main);
349350
border-left: 1px solid var(--brand-main);
@@ -450,7 +451,7 @@ div[name="DOC"] {
450451
color: var(--text-primary);
451452
transform: translateY(-2px);
452453
box-shadow: 0px 6px 30px 5px rgba(0, 0, 0, .05), 0px 16px 24px 2px rgba(0, 0, 0, .04), 0px 8px 10px -5px rgba(0, 0, 0, .08);
453-
454+
454455
.name {
455456
color: var(--text-primary);
456457
}
@@ -459,6 +460,7 @@ div[name="DOC"] {
459460
img {
460461
margin: 8px 0;
461462
max-width: 100%;
463+
width: 100%;
462464
height: auto;
463465
filter: none;
464466
}

pnpm-lock.yaml

Lines changed: 5 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"prismjs": "^1.29.0",
1919
"tdesign-icons-view": "^0.3.5",
2020
"tdesign-icons-vue": "^0.1.4",
21-
"tdesign-site-components": "^0.16.6",
21+
"tdesign-site-components": "^0.16.7",
2222
"tdesign-vue": "1.9.8-naruto",
2323
"three": "0.127.0",
2424
"vue": "2.7.14",

site/src/pages/home/index.vue

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@
238238
</div>
239239
</div>
240240
<!-- swiper content -->
241-
<div class="module-board">
241+
<div class="module-board" id="moduleBoard">
242242
<div class="module-board__inner" :style="`transform: translateX(-${tabTransformWidth}px);`">
243243
<div
244244
:class="[
@@ -254,8 +254,9 @@
254254
<t-radio-button value="vue">vue</t-radio-button>
255255
<t-radio-button value="vue-next">vue-next</t-radio-button>
256256
<t-radio-button value="react">react</t-radio-button>
257-
<t-radio-button value="miniprogram">mini-program</t-radio-button>
258-
<!-- <t-radio-button value="vue-mobile">vue-mobile</t-radio-button> -->
257+
<t-radio-button value="miniprogram">miniprogram</t-radio-button>
258+
<t-radio-button value="mobile-vue">mobile-vue</t-radio-button>
259+
<t-radio-button value="mobile-react">mobile-react</t-radio-button>
259260
</t-radio-group>
260261

261262
<ul class="code-list">
@@ -595,6 +596,7 @@ const brandUrl = 'https://1257786608-faj515jw5t-hk.scf.tencentcs.com/brand/list'
595596
const newsUrl = 'https://1257786608-faj515jw5t-hk.scf.tencentcs.com/news';
596597
597598
const isIntranet = location.host.includes('woa.com'); // 部分动态或内容只能通过内网访问
599+
let ticking = false;
598600
599601
export default {
600602
name: 'site-home',
@@ -716,7 +718,19 @@ export default {
716718
{ type: 'javascript', code: '<t-tag theme="primary">重要</t-tag>' },
717719
{ type: 'javascript', code: '' },
718720
],
719-
// 'vue-mobile': [],
721+
'mobile-vue': [
722+
{ type: 'bash', code: 'npm i tdesign-mobile-vue' },
723+
{ type: 'javascript', code: "import { createApp } from 'vue';" },
724+
{ type: 'javascript', code: "import TDesign from 'tdesign-mobile-vue';" },
725+
{ type: 'javascript', code: "import 'tdesign-mobile-vue/es/style/index.css';" },
726+
{ type: 'javascript', code: 'createApp(App).use(TDesign);' },
727+
],
728+
'mobile-react': [
729+
{ type: 'bash', code: 'npm i tdesign-mobile-react' },
730+
{ type: 'javascript', code: "import { Button } from 'tdesign-mobile-react';" },
731+
{ type: 'javascript', code: "import 'tdesign-mobile-react/es/style/index.css';" },
732+
{ type: 'javascript', code: '' },
733+
],
720734
},
721735
componentModel: {
722736
selectValue: ['1'],
@@ -848,9 +862,8 @@ export default {
848862
this.getBrandList();
849863
this.getNews();
850864
window.addEventListener('resize', this.handleResize);
851-
this.tabTimer = setInterval(() => {
852-
this.currentTab = this.currentTab === 2 ? 0 : this.currentTab + 1;
853-
}, 4000);
865+
window.addEventListener('mousemove', this.handleMousemove);
866+
this.initTabTimer();
854867
},
855868
856869
beforeDestroy() {
@@ -859,9 +872,36 @@ export default {
859872
clearInterval(this.tabTimer);
860873
this.observer.disconnect();
861874
window.removeEventListener('resize', this.handleResize);
875+
window.removeEventListener('mousemove', this.handleMousemove);
862876
},
863877
864878
methods: {
879+
handleMousemove(event) {
880+
if (ticking) return;
881+
ticking = true;
882+
window.requestAnimationFrame(() => {
883+
this.checkMousePosition(event);
884+
ticking = false;
885+
});
886+
},
887+
checkMousePosition(event) {
888+
const element = document.querySelector('#moduleBoard');
889+
if (!element) return;
890+
const isOver = element.contains(event.target);
891+
if (isOver) {
892+
clearInterval(this.tabTimer);
893+
this.tabTimer = null;
894+
return;
895+
}
896+
if (this.tabTimer) return;
897+
this.initTabTimer();
898+
},
899+
initTabTimer() {
900+
clearInterval(this.tabTimer);
901+
this.tabTimer = setInterval(() => {
902+
this.currentTab = this.currentTab === 2 ? 0 : this.currentTab + 1;
903+
}, 4000);
904+
},
865905
handleClickNews(url) {
866906
if (url) window.open(url, '_blank');
867907
},

0 commit comments

Comments
 (0)