mirror of
https://github.com/youzan/vant.git
synced 2025-10-22 03:44:48 +00:00
chore: prettier source code
This commit is contained in:
@@ -32,7 +32,7 @@ export default createComponent({
|
||||
mixins: [
|
||||
TouchMixin,
|
||||
ParentMixin('vanIndexBar'),
|
||||
BindEventMixin(function(bind) {
|
||||
BindEventMixin(function (bind) {
|
||||
if (!this.scroller) {
|
||||
this.scroller = getScroller(this.$el);
|
||||
}
|
||||
@@ -97,7 +97,7 @@ export default createComponent({
|
||||
|
||||
const scrollTop = getScrollTop(this.scroller);
|
||||
const scrollerRect = this.getScrollerRect();
|
||||
const rects = this.children.map(item => ({
|
||||
const rects = this.children.map((item) => ({
|
||||
height: item.height,
|
||||
top: this.getElementTop(item.$el, scrollerRect),
|
||||
}));
|
||||
@@ -198,7 +198,9 @@ export default createComponent({
|
||||
return;
|
||||
}
|
||||
|
||||
const match = this.children.filter(item => String(item.index) === index);
|
||||
const match = this.children.filter(
|
||||
(item) => String(item.index) === index
|
||||
);
|
||||
if (match[0]) {
|
||||
match[0].scrollIntoView();
|
||||
|
||||
@@ -216,7 +218,7 @@ export default createComponent({
|
||||
},
|
||||
|
||||
render() {
|
||||
const Indexes = this.indexList.map(index => {
|
||||
const Indexes = this.indexList.map((index) => {
|
||||
const active = index === this.activeAnchorIndex;
|
||||
|
||||
return (
|
||||
|
@@ -62,7 +62,7 @@ test('touch and scroll to anchor', () => {
|
||||
const sidebar = wrapper.find('.van-index-bar__sidebar');
|
||||
const indexes = wrapper.findAll('.van-index-bar__index');
|
||||
|
||||
document.elementFromPoint = function(x, y) {
|
||||
document.elementFromPoint = function (x, y) {
|
||||
const index = y / 100;
|
||||
|
||||
if (index === 1 || index === 2) {
|
||||
@@ -93,7 +93,7 @@ test('touch and scroll to anchor', () => {
|
||||
|
||||
test('scroll and update active anchor', () => {
|
||||
const nativeRect = Element.prototype.getBoundingClientRect;
|
||||
Element.prototype.getBoundingClientRect = function() {
|
||||
Element.prototype.getBoundingClientRect = function () {
|
||||
const { index } = this.dataset;
|
||||
return {
|
||||
top: index ? index * 10 : 0,
|
||||
|
Reference in New Issue
Block a user