Skip to content

Commit 74fdbf4

Browse files
authored
fix(Indexes): 修复点击右侧索引栏时,click 与 touchend 事件双重触发导致的锚点抖动问题 (#4548)
* chore: use static logo * fix(indexes): 修复点击事件双重触发问题 * chore: update deps
1 parent 3869728 commit 74fdbf4

5 files changed

Lines changed: 11 additions & 4 deletions

File tree

packages/tdesign-uniapp/example/src/pages/home/home.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<image
1313
class="title-icon"
1414
mode="aspectFit"
15-
:src="`https://image-1251917893.file.myqcloud.com/next-svr/images/2025/10/${theme === 'dark' ? 'TDesign-logo_dark' : 'TDesign-logo_light'}.png`"
15+
:src="`/static/${theme === 'dark' ? 'TDesign-logo_dark' : 'TDesign-logo_light'}.png`"
1616
aria-label="TDesign Logo"
1717
/>
1818
</view>
2.87 KB
Loading
2.85 KB
Loading

packages/uniapp-components/indexes/indexes.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export default {
7979
groupTop: [],
8080
sidebar: null,
8181
currentTouchAnchor: null,
82+
touchMoved: false,
8283
8384
dataCurrent: this.current,
8485
};
@@ -256,16 +257,22 @@ export default {
256257
},
257258
258259
onTouchMove(e) {
260+
this.touchMoved = true;
259261
this.onAnchorTouch(e);
260262
},
261263
262264
onTouchCancel() {
265+
this.touchMoved = false;
263266
this.toggleTips(false);
264267
},
265268
266269
onTouchEnd(e) {
270+
// 只有真正拖拽滑动过才走触摸定位,纯点击由 onClick 处理,避免双重触发导致抽搐
271+
if (this.touchMoved) {
272+
this.touchMoved = false;
273+
this.onAnchorTouch(e);
274+
}
267275
this.toggleTips(false);
268-
this.onAnchorTouch(e);
269276
},
270277
271278
onAnchorTouch: throttle(function (e) {

pnpm-workspace.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ catalog:
1616
'@babel/runtime': ^7.16.5
1717
'@commitlint/cli': ^16.3.0
1818
'@commitlint/config-conventional': ^16.2.4
19-
'@plugin-light/vite-plugin-gen-version': ^1.0.1
19+
'@plugin-light/vite-plugin-gen-version': 1.0.2
2020
'@popperjs/core': ^2.11.8
2121
'@rollup/plugin-babel': ^5.2.2
2222
'@rollup/plugin-commonjs': ^21.0.1
@@ -138,7 +138,7 @@ catalog:
138138
stylelint-config-common: 1.0.10
139139
stylelint-config-standard: ^39.0.1
140140
stylelint-less: ^3.0.1
141-
t-comm: ^3.1.14
141+
t-comm: ^3.3.3
142142
tdesign-uniapp-auto-import-resolver: 0.1.3
143143
tinycolor2: ^1.6.0
144144
tslib: ^2.8.1

0 commit comments

Comments
 (0)