@tuya-miniapp/smart-ui 2.12.0-beta-6 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index-bar/index.js +48 -34
- package/dist/index-bar/index.wxml +2 -1
- package/lib/index-bar/index.js +50 -36
- package/lib/index-bar/index.wxml +2 -1
- package/package.json +1 -1
package/dist/index-bar/index.js
CHANGED
|
@@ -61,7 +61,7 @@ SmartComponent({
|
|
|
61
61
|
],
|
|
62
62
|
data: {
|
|
63
63
|
iconSvg,
|
|
64
|
-
|
|
64
|
+
activeAnchorIndexData: null,
|
|
65
65
|
showSidebar: false,
|
|
66
66
|
showMoveIcon: false,
|
|
67
67
|
lowestActiveIndex: -1,
|
|
@@ -203,6 +203,9 @@ SmartComponent({
|
|
|
203
203
|
top: rect.top,
|
|
204
204
|
}));
|
|
205
205
|
},
|
|
206
|
+
getChildrenIndexList() {
|
|
207
|
+
return this.children.map(item => item.data.index);
|
|
208
|
+
},
|
|
206
209
|
getActiveAnchorIndex() {
|
|
207
210
|
const { children, scrollTop } = this;
|
|
208
211
|
const { sticky, stickyOffsetTop } = this.data;
|
|
@@ -215,13 +218,15 @@ SmartComponent({
|
|
|
215
218
|
}
|
|
216
219
|
return -1;
|
|
217
220
|
},
|
|
218
|
-
onScroll(
|
|
221
|
+
onScroll(controlActiveIndexData) {
|
|
222
|
+
var _a, _b, _c, _d;
|
|
219
223
|
const { children = [], scrollTop } = this;
|
|
220
224
|
if (!children.length) {
|
|
221
225
|
return;
|
|
222
226
|
}
|
|
223
|
-
const hasIndex =
|
|
224
|
-
const
|
|
227
|
+
const hasIndex = controlActiveIndexData !== undefined;
|
|
228
|
+
const scrollChildrenGetIndex = this.getActiveAnchorIndex();
|
|
229
|
+
const scrollChildrenGetIndexData = (_a = this.children[scrollChildrenGetIndex]) === null || _a === void 0 ? void 0 : _a.data.index;
|
|
225
230
|
// 程序化滚动(如 sidebar 点击)未完成时,不根据当前 scrollTop 更新 UI,
|
|
226
231
|
// 避免 scrollTop 已变而 anchor 几何未重测导致 getActiveAnchorIndex 算错引发闪动。
|
|
227
232
|
// 滚动结束后在 scrollToAnchor 的 then 里会 setRect + onScroll 做一次正确更新。
|
|
@@ -230,21 +235,29 @@ SmartComponent({
|
|
|
230
235
|
}
|
|
231
236
|
// lowestActiveIndex 已改为在 setRect 后由 computeLowestActiveIndex() 几何计算,此处不再根据滚动推断
|
|
232
237
|
const { sticky, stickyOffsetTop, zIndex, highlightColor } = this.data;
|
|
233
|
-
const
|
|
238
|
+
const activeData = hasIndex ? controlActiveIndexData : scrollChildrenGetIndexData;
|
|
239
|
+
if (activeData === undefined) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
const activeIndex = this.children.findIndex(item => item.data.index === activeData);
|
|
243
|
+
const preActiveData = (_c = (_b = this.children[activeIndex - 1]) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.index;
|
|
234
244
|
this.setDiffData({
|
|
235
245
|
target: this,
|
|
236
246
|
data: {
|
|
237
|
-
|
|
247
|
+
activeAnchorIndexData: activeData,
|
|
238
248
|
},
|
|
239
249
|
});
|
|
240
250
|
if (sticky) {
|
|
241
251
|
let isActiveAnchorSticky = false;
|
|
242
|
-
if (
|
|
243
|
-
isActiveAnchorSticky =
|
|
252
|
+
if (activeData !== null) {
|
|
253
|
+
isActiveAnchorSticky =
|
|
254
|
+
((_d = children.find(item => item.data.index === activeData)) === null || _d === void 0 ? void 0 : _d.top) <=
|
|
255
|
+
stickyOffsetTop + scrollTop;
|
|
244
256
|
}
|
|
245
257
|
children.forEach((item, index) => {
|
|
258
|
+
const itemData = item.data.index;
|
|
246
259
|
// 为当前的 anchor 设置 fixed 吸顶和文字颜色
|
|
247
|
-
if (
|
|
260
|
+
if (itemData === activeData) {
|
|
248
261
|
let wrapperStyle = '';
|
|
249
262
|
let anchorStyle = `
|
|
250
263
|
color: ${highlightColor};
|
|
@@ -270,7 +283,7 @@ SmartComponent({
|
|
|
270
283
|
});
|
|
271
284
|
// 滚动模式时 上一个tab 要有种慢慢被滚动切换的效果
|
|
272
285
|
}
|
|
273
|
-
else if (
|
|
286
|
+
else if (preActiveData === itemData && !hasIndex) {
|
|
274
287
|
const currentAnchor = children[index];
|
|
275
288
|
const currentOffsetTop = currentAnchor.top;
|
|
276
289
|
const targetOffsetTop = index === children.length - 1 ? this.top : children[index + 1].top;
|
|
@@ -306,34 +319,36 @@ SmartComponent({
|
|
|
306
319
|
},
|
|
307
320
|
onClick(event) {
|
|
308
321
|
ty.vibrateShort({ type: 'light' });
|
|
309
|
-
this.scrollToAnchor(event.target.dataset.
|
|
322
|
+
this.scrollToAnchor(event.target.dataset.item);
|
|
310
323
|
},
|
|
311
324
|
onTouchMove(event) {
|
|
312
325
|
if (!this.data.scrollable)
|
|
313
326
|
return;
|
|
314
|
-
const sidebarLength = this.
|
|
327
|
+
const sidebarLength = this.data.indexList.length;
|
|
315
328
|
const touch = event.touches[0];
|
|
316
329
|
let offsetY = touch.clientY - this.sidebar.top;
|
|
317
|
-
const threshold = this.sidebar.height *
|
|
330
|
+
const threshold = (this.sidebar.height / sidebarLength) * 3;
|
|
318
331
|
if (!this.lastValidOffsetYHistory) {
|
|
319
332
|
this.lastValidOffsetYHistory = [];
|
|
320
333
|
}
|
|
321
334
|
const nearCount = this.lastValidOffsetYHistory.filter(h => Math.abs(offsetY - h) < threshold).length;
|
|
335
|
+
this.lastValidOffsetYHistory.push(offsetY);
|
|
336
|
+
if (this.lastValidOffsetYHistory.length > 3)
|
|
337
|
+
this.lastValidOffsetYHistory.shift();
|
|
322
338
|
// 与最近 3 次中至少 2 个都超阈值则判定本帧为异常,沿用上次有效值
|
|
323
339
|
if (this.lastValidOffsetYHistory.length === 3 && nearCount < 2) {
|
|
324
340
|
return;
|
|
325
341
|
}
|
|
326
|
-
this.lastValidOffsetYHistory.push(offsetY);
|
|
327
|
-
if (this.lastValidOffsetYHistory.length > 3)
|
|
328
|
-
this.lastValidOffsetYHistory.shift();
|
|
329
342
|
offsetY = Math.max(0, Math.min(offsetY, this.sidebar.height));
|
|
330
343
|
const itemHeight = this.sidebar.height / sidebarLength;
|
|
331
344
|
const index = Math.floor(offsetY / itemHeight);
|
|
345
|
+
const indexData = this.data.indexList[index];
|
|
332
346
|
this.setData({
|
|
333
347
|
showMoveIcon: true,
|
|
334
348
|
moveTipTop: index * itemHeight + itemHeight / 2,
|
|
349
|
+
currentMoveIconText: indexData,
|
|
335
350
|
});
|
|
336
|
-
this.scrollToAnchor(
|
|
351
|
+
this.scrollToAnchor(indexData);
|
|
337
352
|
},
|
|
338
353
|
onTouchStop() {
|
|
339
354
|
if (!this.data.scrollable)
|
|
@@ -341,20 +356,22 @@ SmartComponent({
|
|
|
341
356
|
this.setData({
|
|
342
357
|
showMoveIcon: false,
|
|
343
358
|
});
|
|
344
|
-
this.
|
|
359
|
+
this.scrollToAnchorIndexData = null;
|
|
345
360
|
this.lastValidOffsetYHistory = [];
|
|
346
361
|
},
|
|
347
|
-
scrollToAnchor(
|
|
348
|
-
if (typeof
|
|
362
|
+
scrollToAnchor(indexData) {
|
|
363
|
+
if (typeof indexData !== 'string' || this.scrollToAnchorIndexData === indexData) {
|
|
349
364
|
return;
|
|
350
365
|
}
|
|
351
|
-
const
|
|
366
|
+
const childrenIndex = this.children.findIndex(item => item.data.index === indexData);
|
|
367
|
+
const anchor = this.children[childrenIndex];
|
|
368
|
+
const safeIndex = this.data.lowestActiveIndex !== -1 && childrenIndex > this.data.lowestActiveIndex
|
|
352
369
|
? this.data.lowestActiveIndex
|
|
353
|
-
:
|
|
354
|
-
const safeAnchor = this.children
|
|
355
|
-
|
|
356
|
-
if (!anchor || !safeAnchor)
|
|
370
|
+
: childrenIndex;
|
|
371
|
+
const safeAnchor = this.children[safeIndex];
|
|
372
|
+
if (!safeAnchor) {
|
|
357
373
|
return;
|
|
374
|
+
}
|
|
358
375
|
// 如果当前有正在进行的滚动,将新的滚动任务加入队列
|
|
359
376
|
if (!this.pendingAnchor) {
|
|
360
377
|
this.pendingAnchor = [];
|
|
@@ -364,18 +381,15 @@ SmartComponent({
|
|
|
364
381
|
return;
|
|
365
382
|
}
|
|
366
383
|
this.pendingAnchor = [anchor];
|
|
367
|
-
this.
|
|
368
|
-
this.setData({
|
|
369
|
-
currentMoveIconText: anchor.data.index,
|
|
370
|
-
});
|
|
384
|
+
this.scrollToAnchorIndexData = indexData;
|
|
371
385
|
safeAnchor
|
|
372
386
|
.scrollIntoView(this.scrollTop)
|
|
373
387
|
.then(() => {
|
|
374
|
-
this.onScroll(
|
|
388
|
+
this.onScroll(safeAnchor.data.index);
|
|
375
389
|
if (this.pendingAnchor.length > 0 && this.pendingAnchor[0] !== anchor) {
|
|
376
|
-
const
|
|
390
|
+
const dataIndex = this.pendingAnchor[0].data.index;
|
|
377
391
|
this.pendingAnchor = [];
|
|
378
|
-
this.scrollToAnchor(
|
|
392
|
+
this.scrollToAnchor(dataIndex);
|
|
379
393
|
return;
|
|
380
394
|
}
|
|
381
395
|
this.pendingAnchor = [];
|
|
@@ -383,9 +397,9 @@ SmartComponent({
|
|
|
383
397
|
.catch(err => {
|
|
384
398
|
console.error(err);
|
|
385
399
|
if (this.pendingAnchor.length > 0 && this.pendingAnchor[0] !== anchor) {
|
|
386
|
-
const
|
|
400
|
+
const dataIndex = this.pendingAnchor[0].data.index;
|
|
387
401
|
this.pendingAnchor = [];
|
|
388
|
-
this.scrollToAnchor(
|
|
402
|
+
this.scrollToAnchor(dataIndex);
|
|
389
403
|
return;
|
|
390
404
|
}
|
|
391
405
|
this.pendingAnchor = [];
|
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
wx:for="{{ indexList }}"
|
|
25
25
|
wx:key="index"
|
|
26
26
|
class="smart-index-bar__index"
|
|
27
|
-
style="z-index: {{ zIndex + 1 }};color: {{
|
|
27
|
+
style="z-index: {{ zIndex + 1 }};color: {{ activeAnchorIndexData === item ? highlightColor : '' }};font-size: {{ sidebarFontSize }};line-height: {{ sidebarLineHeight }};"
|
|
28
28
|
data-index="{{ index }}"
|
|
29
|
+
data-item="{{ item }}"
|
|
29
30
|
>
|
|
30
31
|
{{ item }}
|
|
31
32
|
</view>
|
package/lib/index-bar/index.js
CHANGED
|
@@ -66,7 +66,7 @@ var indexList = function () {
|
|
|
66
66
|
],
|
|
67
67
|
data: {
|
|
68
68
|
iconSvg: icon_1.default,
|
|
69
|
-
|
|
69
|
+
activeAnchorIndexData: null,
|
|
70
70
|
showSidebar: false,
|
|
71
71
|
showMoveIcon: false,
|
|
72
72
|
lowestActiveIndex: -1,
|
|
@@ -216,6 +216,9 @@ var indexList = function () {
|
|
|
216
216
|
top: rect.top,
|
|
217
217
|
}); });
|
|
218
218
|
},
|
|
219
|
+
getChildrenIndexList: function () {
|
|
220
|
+
return this.children.map(function (item) { return item.data.index; });
|
|
221
|
+
},
|
|
219
222
|
getActiveAnchorIndex: function () {
|
|
220
223
|
var _a = this, children = _a.children, scrollTop = _a.scrollTop;
|
|
221
224
|
var _b = this.data, sticky = _b.sticky, stickyOffsetTop = _b.stickyOffsetTop;
|
|
@@ -228,14 +231,16 @@ var indexList = function () {
|
|
|
228
231
|
}
|
|
229
232
|
return -1;
|
|
230
233
|
},
|
|
231
|
-
onScroll: function (
|
|
234
|
+
onScroll: function (controlActiveIndexData) {
|
|
232
235
|
var _this = this;
|
|
233
|
-
var _a
|
|
236
|
+
var _a, _b, _c, _d;
|
|
237
|
+
var _e = this, _f = _e.children, children = _f === void 0 ? [] : _f, scrollTop = _e.scrollTop;
|
|
234
238
|
if (!children.length) {
|
|
235
239
|
return;
|
|
236
240
|
}
|
|
237
|
-
var hasIndex =
|
|
238
|
-
var
|
|
241
|
+
var hasIndex = controlActiveIndexData !== undefined;
|
|
242
|
+
var scrollChildrenGetIndex = this.getActiveAnchorIndex();
|
|
243
|
+
var scrollChildrenGetIndexData = (_a = this.children[scrollChildrenGetIndex]) === null || _a === void 0 ? void 0 : _a.data.index;
|
|
239
244
|
// 程序化滚动(如 sidebar 点击)未完成时,不根据当前 scrollTop 更新 UI,
|
|
240
245
|
// 避免 scrollTop 已变而 anchor 几何未重测导致 getActiveAnchorIndex 算错引发闪动。
|
|
241
246
|
// 滚动结束后在 scrollToAnchor 的 then 里会 setRect + onScroll 做一次正确更新。
|
|
@@ -243,22 +248,30 @@ var indexList = function () {
|
|
|
243
248
|
return;
|
|
244
249
|
}
|
|
245
250
|
// lowestActiveIndex 已改为在 setRect 后由 computeLowestActiveIndex() 几何计算,此处不再根据滚动推断
|
|
246
|
-
var
|
|
247
|
-
var
|
|
251
|
+
var _g = this.data, sticky = _g.sticky, stickyOffsetTop = _g.stickyOffsetTop, zIndex = _g.zIndex, highlightColor = _g.highlightColor;
|
|
252
|
+
var activeData = hasIndex ? controlActiveIndexData : scrollChildrenGetIndexData;
|
|
253
|
+
if (activeData === undefined) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
var activeIndex = this.children.findIndex(function (item) { return item.data.index === activeData; });
|
|
257
|
+
var preActiveData = (_c = (_b = this.children[activeIndex - 1]) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.index;
|
|
248
258
|
this.setDiffData({
|
|
249
259
|
target: this,
|
|
250
260
|
data: {
|
|
251
|
-
|
|
261
|
+
activeAnchorIndexData: activeData,
|
|
252
262
|
},
|
|
253
263
|
});
|
|
254
264
|
if (sticky) {
|
|
255
265
|
var isActiveAnchorSticky_1 = false;
|
|
256
|
-
if (
|
|
257
|
-
isActiveAnchorSticky_1 =
|
|
266
|
+
if (activeData !== null) {
|
|
267
|
+
isActiveAnchorSticky_1 =
|
|
268
|
+
((_d = children.find(function (item) { return item.data.index === activeData; })) === null || _d === void 0 ? void 0 : _d.top) <=
|
|
269
|
+
stickyOffsetTop + scrollTop;
|
|
258
270
|
}
|
|
259
271
|
children.forEach(function (item, index) {
|
|
272
|
+
var itemData = item.data.index;
|
|
260
273
|
// 为当前的 anchor 设置 fixed 吸顶和文字颜色
|
|
261
|
-
if (
|
|
274
|
+
if (itemData === activeData) {
|
|
262
275
|
var wrapperStyle = '';
|
|
263
276
|
var anchorStyle = "\n color: ".concat(highlightColor, ";\n ");
|
|
264
277
|
if (isActiveAnchorSticky_1) {
|
|
@@ -275,7 +288,7 @@ var indexList = function () {
|
|
|
275
288
|
});
|
|
276
289
|
// 滚动模式时 上一个tab 要有种慢慢被滚动切换的效果
|
|
277
290
|
}
|
|
278
|
-
else if (
|
|
291
|
+
else if (preActiveData === itemData && !hasIndex) {
|
|
279
292
|
var currentAnchor = children[index];
|
|
280
293
|
var currentOffsetTop = currentAnchor.top;
|
|
281
294
|
var targetOffsetTop = index === children.length - 1 ? _this.top : children[index + 1].top;
|
|
@@ -306,34 +319,36 @@ var indexList = function () {
|
|
|
306
319
|
},
|
|
307
320
|
onClick: function (event) {
|
|
308
321
|
ty_1.default.vibrateShort({ type: 'light' });
|
|
309
|
-
this.scrollToAnchor(event.target.dataset.
|
|
322
|
+
this.scrollToAnchor(event.target.dataset.item);
|
|
310
323
|
},
|
|
311
324
|
onTouchMove: function (event) {
|
|
312
325
|
if (!this.data.scrollable)
|
|
313
326
|
return;
|
|
314
|
-
var sidebarLength = this.
|
|
327
|
+
var sidebarLength = this.data.indexList.length;
|
|
315
328
|
var touch = event.touches[0];
|
|
316
329
|
var offsetY = touch.clientY - this.sidebar.top;
|
|
317
|
-
var threshold = this.sidebar.height *
|
|
330
|
+
var threshold = (this.sidebar.height / sidebarLength) * 3;
|
|
318
331
|
if (!this.lastValidOffsetYHistory) {
|
|
319
332
|
this.lastValidOffsetYHistory = [];
|
|
320
333
|
}
|
|
321
334
|
var nearCount = this.lastValidOffsetYHistory.filter(function (h) { return Math.abs(offsetY - h) < threshold; }).length;
|
|
335
|
+
this.lastValidOffsetYHistory.push(offsetY);
|
|
336
|
+
if (this.lastValidOffsetYHistory.length > 3)
|
|
337
|
+
this.lastValidOffsetYHistory.shift();
|
|
322
338
|
// 与最近 3 次中至少 2 个都超阈值则判定本帧为异常,沿用上次有效值
|
|
323
339
|
if (this.lastValidOffsetYHistory.length === 3 && nearCount < 2) {
|
|
324
340
|
return;
|
|
325
341
|
}
|
|
326
|
-
this.lastValidOffsetYHistory.push(offsetY);
|
|
327
|
-
if (this.lastValidOffsetYHistory.length > 3)
|
|
328
|
-
this.lastValidOffsetYHistory.shift();
|
|
329
342
|
offsetY = Math.max(0, Math.min(offsetY, this.sidebar.height));
|
|
330
343
|
var itemHeight = this.sidebar.height / sidebarLength;
|
|
331
344
|
var index = Math.floor(offsetY / itemHeight);
|
|
345
|
+
var indexData = this.data.indexList[index];
|
|
332
346
|
this.setData({
|
|
333
347
|
showMoveIcon: true,
|
|
334
348
|
moveTipTop: index * itemHeight + itemHeight / 2,
|
|
349
|
+
currentMoveIconText: indexData,
|
|
335
350
|
});
|
|
336
|
-
this.scrollToAnchor(
|
|
351
|
+
this.scrollToAnchor(indexData);
|
|
337
352
|
},
|
|
338
353
|
onTouchStop: function () {
|
|
339
354
|
if (!this.data.scrollable)
|
|
@@ -341,21 +356,23 @@ var indexList = function () {
|
|
|
341
356
|
this.setData({
|
|
342
357
|
showMoveIcon: false,
|
|
343
358
|
});
|
|
344
|
-
this.
|
|
359
|
+
this.scrollToAnchorIndexData = null;
|
|
345
360
|
this.lastValidOffsetYHistory = [];
|
|
346
361
|
},
|
|
347
|
-
scrollToAnchor: function (
|
|
362
|
+
scrollToAnchor: function (indexData) {
|
|
348
363
|
var _this = this;
|
|
349
|
-
if (typeof
|
|
364
|
+
if (typeof indexData !== 'string' || this.scrollToAnchorIndexData === indexData) {
|
|
350
365
|
return;
|
|
351
366
|
}
|
|
352
|
-
var
|
|
367
|
+
var childrenIndex = this.children.findIndex(function (item) { return item.data.index === indexData; });
|
|
368
|
+
var anchor = this.children[childrenIndex];
|
|
369
|
+
var safeIndex = this.data.lowestActiveIndex !== -1 && childrenIndex > this.data.lowestActiveIndex
|
|
353
370
|
? this.data.lowestActiveIndex
|
|
354
|
-
:
|
|
355
|
-
var safeAnchor = this.children
|
|
356
|
-
|
|
357
|
-
if (!anchor || !safeAnchor)
|
|
371
|
+
: childrenIndex;
|
|
372
|
+
var safeAnchor = this.children[safeIndex];
|
|
373
|
+
if (!safeAnchor) {
|
|
358
374
|
return;
|
|
375
|
+
}
|
|
359
376
|
// 如果当前有正在进行的滚动,将新的滚动任务加入队列
|
|
360
377
|
if (!this.pendingAnchor) {
|
|
361
378
|
this.pendingAnchor = [];
|
|
@@ -365,18 +382,15 @@ var indexList = function () {
|
|
|
365
382
|
return;
|
|
366
383
|
}
|
|
367
384
|
this.pendingAnchor = [anchor];
|
|
368
|
-
this.
|
|
369
|
-
this.setData({
|
|
370
|
-
currentMoveIconText: anchor.data.index,
|
|
371
|
-
});
|
|
385
|
+
this.scrollToAnchorIndexData = indexData;
|
|
372
386
|
safeAnchor
|
|
373
387
|
.scrollIntoView(this.scrollTop)
|
|
374
388
|
.then(function () {
|
|
375
|
-
_this.onScroll(
|
|
389
|
+
_this.onScroll(safeAnchor.data.index);
|
|
376
390
|
if (_this.pendingAnchor.length > 0 && _this.pendingAnchor[0] !== anchor) {
|
|
377
|
-
var
|
|
391
|
+
var dataIndex = _this.pendingAnchor[0].data.index;
|
|
378
392
|
_this.pendingAnchor = [];
|
|
379
|
-
_this.scrollToAnchor(
|
|
393
|
+
_this.scrollToAnchor(dataIndex);
|
|
380
394
|
return;
|
|
381
395
|
}
|
|
382
396
|
_this.pendingAnchor = [];
|
|
@@ -384,9 +398,9 @@ var indexList = function () {
|
|
|
384
398
|
.catch(function (err) {
|
|
385
399
|
console.error(err);
|
|
386
400
|
if (_this.pendingAnchor.length > 0 && _this.pendingAnchor[0] !== anchor) {
|
|
387
|
-
var
|
|
401
|
+
var dataIndex = _this.pendingAnchor[0].data.index;
|
|
388
402
|
_this.pendingAnchor = [];
|
|
389
|
-
_this.scrollToAnchor(
|
|
403
|
+
_this.scrollToAnchor(dataIndex);
|
|
390
404
|
return;
|
|
391
405
|
}
|
|
392
406
|
_this.pendingAnchor = [];
|
package/lib/index-bar/index.wxml
CHANGED
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
wx:for="{{ indexList }}"
|
|
25
25
|
wx:key="index"
|
|
26
26
|
class="smart-index-bar__index"
|
|
27
|
-
style="z-index: {{ zIndex + 1 }};color: {{
|
|
27
|
+
style="z-index: {{ zIndex + 1 }};color: {{ activeAnchorIndexData === item ? highlightColor : '' }};font-size: {{ sidebarFontSize }};line-height: {{ sidebarLineHeight }};"
|
|
28
28
|
data-index="{{ index }}"
|
|
29
|
+
data-item="{{ item }}"
|
|
29
30
|
>
|
|
30
31
|
{{ item }}
|
|
31
32
|
</view>
|