chore: add trailingComma
This commit is contained in:
@@ -41,12 +41,12 @@ export default {
|
||||
i18n: {
|
||||
'zh-CN': {
|
||||
text: '文本',
|
||||
customIndexList: '自定义索引列表'
|
||||
customIndexList: '自定义索引列表',
|
||||
},
|
||||
'en-US': {
|
||||
text: 'Text',
|
||||
customIndexList: 'Custom Index List'
|
||||
}
|
||||
customIndexList: 'Custom Index List',
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
@@ -60,8 +60,8 @@ export default {
|
||||
BLUE,
|
||||
activeTab: 0,
|
||||
indexList,
|
||||
customIndexList: [1, 2, 3, 4, 5, 6, 8, 9, 10]
|
||||
customIndexList: [1, 2, 3, 4, 5, 6, 8, 9, 10],
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
+16
-16
@@ -10,7 +10,7 @@ import {
|
||||
getElementTop,
|
||||
getRootScrollTop,
|
||||
setRootScrollTop,
|
||||
getScroller
|
||||
getScroller,
|
||||
} from '../utils/dom/scroll';
|
||||
|
||||
const [createComponent, bem] = createNamespace('index-bar');
|
||||
@@ -25,25 +25,25 @@ export default createComponent({
|
||||
}
|
||||
|
||||
bind(this.scroller, 'scroll', this.onScroll);
|
||||
})
|
||||
}),
|
||||
],
|
||||
|
||||
props: {
|
||||
sticky: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
zIndex: {
|
||||
type: Number,
|
||||
default: 1
|
||||
default: 1,
|
||||
},
|
||||
highlightColor: {
|
||||
type: String,
|
||||
default: GREEN
|
||||
default: GREEN,
|
||||
},
|
||||
stickyOffsetTop: {
|
||||
type: Number,
|
||||
default: 0
|
||||
default: 0,
|
||||
},
|
||||
indexList: {
|
||||
type: Array,
|
||||
@@ -56,13 +56,13 @@ export default createComponent({
|
||||
}
|
||||
|
||||
return indexList;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
activeAnchorIndex: null
|
||||
activeAnchorIndex: null,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -72,16 +72,16 @@ export default createComponent({
|
||||
if (highlightColor) {
|
||||
/* istanbul ignore else */
|
||||
return {
|
||||
color: highlightColor
|
||||
color: highlightColor,
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
indexList() {
|
||||
this.$nextTick(this.onScroll);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
@@ -94,7 +94,7 @@ export default createComponent({
|
||||
const scrollerRect = this.getScrollerRect();
|
||||
const rects = this.children.map(item => ({
|
||||
height: item.height,
|
||||
top: this.getElementTop(item.$el, scrollerRect)
|
||||
top: this.getElementTop(item.$el, scrollerRect),
|
||||
}));
|
||||
|
||||
const active = this.getActiveAnchorIndex(scrollTop, rects);
|
||||
@@ -132,7 +132,7 @@ export default createComponent({
|
||||
const { scroller } = this;
|
||||
let scrollerRect = {
|
||||
top: 0,
|
||||
left: 0
|
||||
left: 0,
|
||||
};
|
||||
|
||||
if (scroller.getBoundingClientRect) {
|
||||
@@ -210,7 +210,7 @@ export default createComponent({
|
||||
|
||||
onTouchEnd() {
|
||||
this.active = null;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
render() {
|
||||
@@ -244,5 +244,5 @@ export default createComponent({
|
||||
{this.slots('default')}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ function mockOffsetHeight(offsetHeight) {
|
||||
Object.defineProperty(HTMLElement.prototype, 'offsetHeight', {
|
||||
get() {
|
||||
return offsetHeight;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ test('custom anchor text', () => {
|
||||
<van-index-anchor index="A">Title A</van-index-anchor>
|
||||
<van-index-anchor index="B">Title B</van-index-anchor>
|
||||
</van-index-bar>
|
||||
`
|
||||
`,
|
||||
});
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
@@ -37,8 +37,8 @@ test('click and scroll to anchor', () => {
|
||||
</van-index-bar>
|
||||
`,
|
||||
methods: {
|
||||
onSelect
|
||||
}
|
||||
onSelect,
|
||||
},
|
||||
});
|
||||
|
||||
const fn = mockScrollIntoView();
|
||||
@@ -60,8 +60,8 @@ test('touch and scroll to anchor', () => {
|
||||
</van-index-bar>
|
||||
`,
|
||||
methods: {
|
||||
onSelect
|
||||
}
|
||||
onSelect,
|
||||
},
|
||||
});
|
||||
|
||||
const fn = mockScrollIntoView();
|
||||
@@ -77,7 +77,7 @@ test('touch and scroll to anchor', () => {
|
||||
|
||||
if (index === 3) {
|
||||
return {
|
||||
dataset: {}
|
||||
dataset: {},
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -102,7 +102,7 @@ test('scroll and update active anchor', () => {
|
||||
Element.prototype.getBoundingClientRect = function () {
|
||||
const { index } = this.dataset;
|
||||
return {
|
||||
top: index ? index * 10 : 0
|
||||
top: index ? index * 10 : 0,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -121,9 +121,9 @@ test('scroll and update active anchor', () => {
|
||||
`,
|
||||
data() {
|
||||
return {
|
||||
sticky: false
|
||||
sticky: false,
|
||||
};
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
window.scrollTop = 0;
|
||||
|
||||
Reference in New Issue
Block a user