chore: prettier source code

This commit is contained in:
chenjiahan
2020-04-02 15:36:02 +08:00
parent 340c56b3b5
commit 2fb5cca49a
93 changed files with 272 additions and 283 deletions

View File

@@ -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 (

View File

@@ -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,