From b6e7d3eee54df35696c16810233857243f967eb4 Mon Sep 17 00:00:00 2001 From: jizhi Date: Mon, 18 Jan 2021 21:20:10 +0800 Subject: [PATCH 01/25] docs: fix typo --- .../docs/en-US/guide/base-scroll-api.md | 20 ++++++++++--------- .../docs/zh-CN/guide/base-scroll-api.md | 8 ++++---- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/packages/vuepress-docs/docs/en-US/guide/base-scroll-api.md b/packages/vuepress-docs/docs/en-US/guide/base-scroll-api.md index 88d9139c..2cc00292 100644 --- a/packages/vuepress-docs/docs/en-US/guide/base-scroll-api.md +++ b/packages/vuepress-docs/docs/en-US/guide/base-scroll-api.md @@ -313,7 +313,7 @@ In 2.0, BetterScroll events are almost same with 1.x events. Only BetterScroll w ```typescript // bs version >= 2.0.4 bs.on('contentChanged', (newContent: HTMLElement) => {}) - ``` + ``` The following events must be registered for the **plugin** in parentheses to be dispatched: @@ -331,13 +331,15 @@ The following events must be registered for the **plugin** in parentheses to be bs.on('alterOptions', (mouseWheelOptions) => { /** - * mouseWheelOptions.speed:鼠标滚轮滚动的速度 - * mouseWheelOptions.invert:滚轮滚动和 BetterScroll 滚动的方向是否一致 - * mouseWheelOptions.easeTime:滚动动画的缓动时长。 - * mouseWheelOptions.discreteTime:触发 wheelEnd 的间隔时长 - * mouseWheelOptions.throttleTime:滚轮滚动是高频率的动作,因此可以通过 throttleTime 来限制触发频率 - * mouseWheelOptions.dampingFactor:阻尼因子,当超出边界会施加阻力 + * mouseWheelOptions.speed + * mouseWheelOptions.invert + * mouseWheelOptions.easeTime + * mouseWheelOptions.discreteTime + * mouseWheelOptions.throttleTime + * mouseWheelOptions.dampingFactor **/ + + // please see details in mouse-wheel plugin doc }) ``` @@ -522,7 +524,7 @@ A hook is a concept extended from version 2.0. Its essence is the same as an eve const bs = new BScroll('.wrapper', {}) bs.hooks.on('destroy', () => { console.log('destroyed') }) ``` - + - **contentChanged**(2.0.4) - **Trigger timing**:When calling `bs.refresh()`, it is detected that the content DOM has become other elements - **Usage** @@ -532,7 +534,7 @@ A hook is a concept extended from version 2.0. Its essence is the same as an eve // bs version >= 2.0.4 bs.hooks.on('contentChanged', (newContent: HTMLElement) => { console.log(newContent) }) ``` - + - **ActionsHandler.hooks** diff --git a/packages/vuepress-docs/docs/zh-CN/guide/base-scroll-api.md b/packages/vuepress-docs/docs/zh-CN/guide/base-scroll-api.md index 192b97a6..7bd8cc31 100644 --- a/packages/vuepress-docs/docs/zh-CN/guide/base-scroll-api.md +++ b/packages/vuepress-docs/docs/zh-CN/guide/base-scroll-api.md @@ -27,12 +27,12 @@ ### maxScrollY - **类型**:number - **作用**:bs 最大纵向滚动位置。 - - **备注**:bs 纵向滚动的位置区间是 [minScrollY, maxScrollY],并且 maxScrollY 是负值,maxScrollY 是正值。 + - **备注**:bs 纵向滚动的位置区间是 [minScrollY, maxScrollY],并且 maxScrollY 是负值。 ### minScrollY - **类型**:number - **作用**:bs 最小纵向滚动位置。 - - **备注**:bs 纵向滚动的位置区间是 [minScrollY, maxScrollY],并且 minScrollY 是正值 + - **备注**:bs 纵向滚动的位置区间是 [minScrollY, maxScrollY],并且 minScrollY 是正值。 ### movingDirectionX - **类型**:number @@ -312,7 +312,7 @@ BetterScroll 提供了很多灵活的 API,当我们基于 BetterScroll 去实 ```typescript // bs 版本 >= 2.0.4 bs.on('contentChanged', (newContent: HTMLElement) => {}) - ``` + ``` 以下的事件必须注册括号中的**插件**才会派发: @@ -531,7 +531,7 @@ BetterScroll 提供了很多灵活的 API,当我们基于 BetterScroll 去实 // bs 版本 >= 2.0.4 bs.hooks.on('contentChanged', (newContent: HTMLElement) => { console.log(newContent) }) ``` - + - **ActionsHandler.hooks** - **beforeStart** From c36034ef5d53a9163bc9195d80bbeca2135a3946 Mon Sep 17 00:00:00 2001 From: chenyulun Date: Thu, 21 Jan 2021 23:07:20 +0800 Subject: [PATCH 02/25] fix(shared-utils): add touchcancel trigger the end event hook --- .../core/src/__tests__/__utils__/event.ts | 7 ++++++ .../src/base/__tests__/ActionsHandler.spec.ts | 22 +++++++++++++++++-- packages/shared-utils/src/dom.ts | 2 ++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/packages/core/src/__tests__/__utils__/event.ts b/packages/core/src/__tests__/__utils__/event.ts index 044663bb..5c5ba4bb 100644 --- a/packages/core/src/__tests__/__utils__/event.ts +++ b/packages/core/src/__tests__/__utils__/event.ts @@ -65,6 +65,13 @@ export function dispatchTouchEnd( dispatchTouch(target, 'touchend', touches) } +export function dispatchTouchCancel( + target: EventTarget, + touches: CustomTouches +): void { + dispatchTouch(target, 'touchcancel', touches) +} + export function dispatchSwipe( target: EventTarget, touches: CustomTouches, diff --git a/packages/core/src/base/__tests__/ActionsHandler.spec.ts b/packages/core/src/base/__tests__/ActionsHandler.spec.ts index c38fc9b5..57028f7c 100644 --- a/packages/core/src/base/__tests__/ActionsHandler.spec.ts +++ b/packages/core/src/base/__tests__/ActionsHandler.spec.ts @@ -4,6 +4,9 @@ import ActionsHandler, { import { dispatchTouch, dispatchMouse, + dispatchTouchStart, + dispatchTouchEnd, + dispatchTouchCancel, } from '@better-scroll/core/src/__tests__/__utils__/event' describe('ActionsHandler', () => { @@ -121,9 +124,24 @@ describe('ActionsHandler', () => { actionsHandler.hooks.on('end', endMockHandler) - dispatchMouse(wrapper, 'mousedown') + dispatchTouchStart(wrapper, [{ pageX: 0, pageY: 0 }]) + + dispatchTouchEnd(window, [{ pageX: 0, pageY: 0 }]) + + expect(endMockHandler).toBeCalled() + }) + + it('should invoke end method when dispatch touchcancel', () => { + actionsHandler = new ActionsHandler(wrapper, options) + const endMockHandler = jest.fn().mockImplementation(() => { + return 'dummy test' + }) + + actionsHandler.hooks.on('end', endMockHandler) + + dispatchTouchStart(wrapper, [{ pageX: 0, pageY: 0 }]) - dispatchMouse(window, 'mouseup') + dispatchTouchCancel(window, [{ pageX: 0, pageY: 0 }]) expect(endMockHandler).toBeCalled() }) diff --git a/packages/shared-utils/src/dom.ts b/packages/shared-utils/src/dom.ts index d62af2e5..644cacf2 100755 --- a/packages/shared-utils/src/dom.ts +++ b/packages/shared-utils/src/dom.ts @@ -150,6 +150,7 @@ export const eventTypeMap: { touchstart: number touchmove: number touchend: number + touchcancel: number mousedown: number mousemove: number mouseup: number @@ -157,6 +158,7 @@ export const eventTypeMap: { touchstart: 1, touchmove: 1, touchend: 1, + touchcancel: 1, mousedown: 2, mousemove: 2, From 5a6aaa889f7fd35107c63da6ada2e224cefd6d02 Mon Sep 17 00:00:00 2001 From: jizhi Date: Fri, 22 Jan 2021 00:47:59 +0800 Subject: [PATCH 03/25] v2.1.2 --- lerna.json | 2 +- packages/better-scroll/package.json | 28 ++++++++++++++-------------- packages/core/package.json | 4 ++-- packages/examples/package.json | 2 +- packages/infinity/package.json | 4 ++-- packages/mouse-wheel/package.json | 4 ++-- packages/movable/package.json | 4 ++-- packages/nested-scroll/package.json | 4 ++-- packages/observe-dom/package.json | 4 ++-- packages/observe-image/package.json | 4 ++-- packages/pull-down/package.json | 4 ++-- packages/pull-up/package.json | 4 ++-- packages/scroll-bar/package.json | 4 ++-- packages/shared-utils/package.json | 2 +- packages/slide/package.json | 4 ++-- packages/vuepress-docs/package.json | 2 +- packages/wheel/package.json | 4 ++-- packages/zoom/package.json | 4 ++-- 18 files changed, 44 insertions(+), 44 deletions(-) diff --git a/lerna.json b/lerna.json index 02625376..4c57da00 100644 --- a/lerna.json +++ b/lerna.json @@ -4,5 +4,5 @@ "packages": [ "packages/*" ], - "version": "2.1.1" + "version": "2.1.2" } diff --git a/packages/better-scroll/package.json b/packages/better-scroll/package.json index 3fa534af..e4fc434d 100644 --- a/packages/better-scroll/package.json +++ b/packages/better-scroll/package.json @@ -1,6 +1,6 @@ { "name": "better-scroll", - "version": "2.1.1", + "version": "2.1.2", "description": "Full-featured BetterScroll", "author": { "name": "huangyi", @@ -31,19 +31,19 @@ "directory": "packages/better-scroll" }, "dependencies": { - "@better-scroll/core": "^2.1.1", - "@better-scroll/infinity": "^2.1.1", - "@better-scroll/mouse-wheel": "^2.1.1", - "@better-scroll/movable": "^2.1.1", - "@better-scroll/nested-scroll": "^2.1.1", - "@better-scroll/observe-dom": "^2.1.1", - "@better-scroll/observe-image": "^2.1.1", - "@better-scroll/pull-down": "^2.1.1", - "@better-scroll/pull-up": "^2.1.1", - "@better-scroll/scroll-bar": "^2.1.1", - "@better-scroll/slide": "^2.1.1", - "@better-scroll/wheel": "^2.1.1", - "@better-scroll/zoom": "^2.1.1" + "@better-scroll/core": "^2.1.2", + "@better-scroll/infinity": "^2.1.2", + "@better-scroll/mouse-wheel": "^2.1.2", + "@better-scroll/movable": "^2.1.2", + "@better-scroll/nested-scroll": "^2.1.2", + "@better-scroll/observe-dom": "^2.1.2", + "@better-scroll/observe-image": "^2.1.2", + "@better-scroll/pull-down": "^2.1.2", + "@better-scroll/pull-up": "^2.1.2", + "@better-scroll/scroll-bar": "^2.1.2", + "@better-scroll/slide": "^2.1.2", + "@better-scroll/wheel": "^2.1.2", + "@better-scroll/zoom": "^2.1.2" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/core/package.json b/packages/core/package.json index 5747455c..82a24d11 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/core", - "version": "2.1.1", + "version": "2.1.2", "description": "Minimalistic core scrolling for BetterScroll, it is pure and tiny", "author": { "name": "huangyi", @@ -31,7 +31,7 @@ "directory": "packages/core" }, "dependencies": { - "@better-scroll/shared-utils": "^2.1.1" + "@better-scroll/shared-utils": "^2.1.2" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/examples/package.json b/packages/examples/package.json index 7e3fe702..5937b7a9 100644 --- a/packages/examples/package.json +++ b/packages/examples/package.json @@ -1,6 +1,6 @@ { "name": "examples", - "version": "2.1.1", + "version": "2.1.2", "description": "Examples of BetterScroll", "author": { "name": "huangyi", diff --git a/packages/infinity/package.json b/packages/infinity/package.json index cc0a181d..c1c8f539 100644 --- a/packages/infinity/package.json +++ b/packages/infinity/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/infinity", - "version": "2.1.1", + "version": "2.1.2", "description": "The ability to inject a infinity load for BetterScroll.", "author": "fengweiyao ", "main": "dist/infinity.min.js", @@ -27,7 +27,7 @@ "directory": "packages/infinity" }, "dependencies": { - "@better-scroll/core": "^2.1.1" + "@better-scroll/core": "^2.1.2" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/mouse-wheel/package.json b/packages/mouse-wheel/package.json index c5d9eea9..2a305fd6 100644 --- a/packages/mouse-wheel/package.json +++ b/packages/mouse-wheel/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/mouse-wheel", - "version": "2.1.1", + "version": "2.1.2", "description": "support for MouseWheel in PC", "author": "huangyi ", "main": "dist/mouse-wheel.min.js", @@ -27,7 +27,7 @@ "directory": "packages/mouse-wheel" }, "dependencies": { - "@better-scroll/core": "^2.1.1" + "@better-scroll/core": "^2.1.2" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/movable/package.json b/packages/movable/package.json index 38faa939..747edd3e 100644 --- a/packages/movable/package.json +++ b/packages/movable/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/movable", - "version": "2.1.1", + "version": "2.1.2", "description": "Movable plugin for BetterScroll", "author": "huangyi ", "main": "dist/movable.min.js", @@ -27,6 +27,6 @@ "directory": "packages/observe-dom" }, "dependencies": { - "@better-scroll/core": "^2.1.1" + "@better-scroll/core": "^2.1.2" } } diff --git a/packages/nested-scroll/package.json b/packages/nested-scroll/package.json index 67d4674a..c21a7163 100644 --- a/packages/nested-scroll/package.json +++ b/packages/nested-scroll/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/nested-scroll", - "version": "2.1.1", + "version": "2.1.2", "description": "make your nested scrolls reconciliation", "author": { "name": "huangyi", @@ -31,7 +31,7 @@ "directory": "packages/nested-scroll" }, "dependencies": { - "@better-scroll/core": "^2.1.1" + "@better-scroll/core": "^2.1.2" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/observe-dom/package.json b/packages/observe-dom/package.json index b52f8a67..8fcb488c 100644 --- a/packages/observe-dom/package.json +++ b/packages/observe-dom/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/observe-dom", - "version": "2.1.1", + "version": "2.1.2", "description": "Dynamic recalculating container's size for BetterScroll", "author": "huangyi ", "main": "dist/observe-dom.min.js", @@ -27,7 +27,7 @@ "directory": "packages/observe-dom" }, "dependencies": { - "@better-scroll/core": "^2.1.1" + "@better-scroll/core": "^2.1.2" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/observe-image/package.json b/packages/observe-image/package.json index 98590f93..6888447e 100644 --- a/packages/observe-image/package.json +++ b/packages/observe-image/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/observe-image", - "version": "2.1.1", + "version": "2.1.2", "description": "Observe image loading for BetterScroll", "author": "theniceangel ", "homepage": "https://github.com/ustbhuangyi/better-scroll/tree/master/packages/observe-image#readme", @@ -28,6 +28,6 @@ "url": "https://github.com/ustbhuangyi/better-scroll/issues" }, "dependencies": { - "@better-scroll/core": "^2.1.1" + "@better-scroll/core": "^2.1.2" } } diff --git a/packages/pull-down/package.json b/packages/pull-down/package.json index 8020a350..029e9690 100644 --- a/packages/pull-down/package.json +++ b/packages/pull-down/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/pull-down", - "version": "2.1.1", + "version": "2.1.2", "description": "pull down to refresh, behave likes App list refreshing", "author": "huangyi ", "main": "dist/pull-down.min.js", @@ -28,7 +28,7 @@ "directory": "packages/pull-down" }, "dependencies": { - "@better-scroll/core": "^2.1.1" + "@better-scroll/core": "^2.1.2" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/pull-up/package.json b/packages/pull-up/package.json index d9009c13..1ff99068 100644 --- a/packages/pull-up/package.json +++ b/packages/pull-up/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/pull-up", - "version": "2.1.1", + "version": "2.1.2", "description": "pull up to load more data", "author": "huangyi ", "main": "dist/pull-up.min.js", @@ -27,7 +27,7 @@ "directory": "packages/pull-up" }, "dependencies": { - "@better-scroll/core": "^2.1.1" + "@better-scroll/core": "^2.1.2" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/scroll-bar/package.json b/packages/scroll-bar/package.json index bf0330b3..a6685132 100644 --- a/packages/scroll-bar/package.json +++ b/packages/scroll-bar/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/scroll-bar", - "version": "2.1.1", + "version": "2.1.2", "description": "scrollbar is used to BetterScroll, which behaves like browser scrollbar", "author": "huangyi ", "main": "dist/scroll-bar.min.js", @@ -27,7 +27,7 @@ "directory": "packages/scroll-bar" }, "dependencies": { - "@better-scroll/core": "^2.1.1" + "@better-scroll/core": "^2.1.2" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/shared-utils/package.json b/packages/shared-utils/package.json index 4e79370b..70395552 100644 --- a/packages/shared-utils/package.json +++ b/packages/shared-utils/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/shared-utils", - "version": "2.1.1", + "version": "2.1.2", "description": "shared-utils for BetterScroll", "author": "huangyi ", "main": "dist/shared-utils.min.js", diff --git a/packages/slide/package.json b/packages/slide/package.json index 1fb9bcc6..30a1c082 100644 --- a/packages/slide/package.json +++ b/packages/slide/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/slide", - "version": "2.1.1", + "version": "2.1.2", "description": "a carousel effect triggered by BetterScroll", "author": "huangyi ", "main": "dist/slide.min.js", @@ -27,7 +27,7 @@ "directory": "packages/slide" }, "dependencies": { - "@better-scroll/core": "^2.1.1" + "@better-scroll/core": "^2.1.2" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/vuepress-docs/package.json b/packages/vuepress-docs/package.json index 9f6f2992..7689223c 100644 --- a/packages/vuepress-docs/package.json +++ b/packages/vuepress-docs/package.json @@ -1,6 +1,6 @@ { "name": "vuepress-docs", - "version": "2.1.1", + "version": "2.1.2", "description": "Docs of BetterScroll", "author": { "name": "huangyi", diff --git a/packages/wheel/package.json b/packages/wheel/package.json index 853c0af8..61ad786f 100644 --- a/packages/wheel/package.json +++ b/packages/wheel/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/wheel", - "version": "2.1.1", + "version": "2.1.2", "description": "a BetterScroll plugin to imitate IOS Picker", "author": { "name": "huangyi", @@ -29,7 +29,7 @@ "url": "git@github.com:ustbhuangyi/better-scroll.git" }, "dependencies": { - "@better-scroll/core": "^2.1.1" + "@better-scroll/core": "^2.1.2" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/zoom/package.json b/packages/zoom/package.json index 4a896ecb..7fade342 100644 --- a/packages/zoom/package.json +++ b/packages/zoom/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/zoom", - "version": "2.1.1", + "version": "2.1.2", "description": "a BetterScroll plugin to enlarge or narrow", "author": { "name": "huangyi", @@ -32,7 +32,7 @@ "directory": "packages/zoom" }, "dependencies": { - "@better-scroll/core": "^2.1.1" + "@better-scroll/core": "^2.1.2" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } From 408a3d54d48e39993e4827ff5e31cb75d5310209 Mon Sep 17 00:00:00 2001 From: CQAmin <421429448@qq.com> Date: Tue, 3 Nov 2020 18:28:05 +0800 Subject: [PATCH 04/25] Update diagnosis.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加国产浏览器横向滑动卡顿问题解决方案 --- packages/vuepress-docs/docs/zh-CN/FAQ/diagnosis.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/vuepress-docs/docs/zh-CN/FAQ/diagnosis.md b/packages/vuepress-docs/docs/zh-CN/FAQ/diagnosis.md index 18cb9b25..e4832572 100644 --- a/packages/vuepress-docs/docs/zh-CN/FAQ/diagnosis.md +++ b/packages/vuepress-docs/docs/zh-CN/FAQ/diagnosis.md @@ -163,4 +163,16 @@ BetterScroll 提供了 `slide` 的 feature。如果实现了一个横向滚动 let innerBS = new BScroll('.wrapper', { eventPassthrough: 'vertical' // 保持纵向的原生浏览器滚动 }) - ``` \ No newline at end of file + ``` + +### 【问题九】国产浏览器中,横向 slide 切换卡顿或无效问题。 + +- **原因** + + 国产浏览器大多数都会监听默认的横滑事件,以实现浏览器的快速“回退”和”前进“。 + +- **解决** + + 主要是使用一个css特性`touch-action`,如果是横向的滑动,将`touch-action: pan-y`,这样就可以避免横向的切换触发浏览器的默认行为。 + + From 6724ee6aa700f56a09effdb51c0c2240628640ae Mon Sep 17 00:00:00 2001 From: theniceangel Date: Thu, 7 Jan 2021 10:07:22 +0800 Subject: [PATCH 05/25] docs(mouse-wheel): optimize docs --- .../docs/en-US/plugins/mouse-wheel.md | 23 +++++++++++++++++++ .../docs/zh-CN/plugins/mouse-wheel.md | 23 +++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/packages/vuepress-docs/docs/en-US/plugins/mouse-wheel.md b/packages/vuepress-docs/docs/en-US/plugins/mouse-wheel.md index 9564cead..8a39db4e 100644 --- a/packages/vuepress-docs/docs/en-US/plugins/mouse-wheel.md +++ b/packages/vuepress-docs/docs/en-US/plugins/mouse-wheel.md @@ -205,6 +205,29 @@ The mouseWheel plugin can also be used with other plugins to increase the operat Damping factor, the value range is [0, 1]. When BetterScroll rolls out of the boundary, resistance needs to be applied to prevent the rolling range from being too large. The smaller the value, the greater the resistance. +:::tip +When `mouseWheel` is configured as `true`, the plugin uses the default plugin option. + +```js +const bs = new BScroll('.wrapper', { + mouseWheel: true +}) + +// equals + +const bs = new BScroll('.wrapper', { + mouseWheel: { + speed: 20, + invert: false, + easeTime: 300, + discreteTime: 400, + throttleTime: 0, + dampingFactor: 0.1 + } +}) +``` +::: + ## Events ### alterOptions diff --git a/packages/vuepress-docs/docs/zh-CN/plugins/mouse-wheel.md b/packages/vuepress-docs/docs/zh-CN/plugins/mouse-wheel.md index 4b43530b..8ebb36d0 100644 --- a/packages/vuepress-docs/docs/zh-CN/plugins/mouse-wheel.md +++ b/packages/vuepress-docs/docs/zh-CN/plugins/mouse-wheel.md @@ -204,6 +204,29 @@ mouseWheel 插件还可以搭配其他的插件,为其增加鼠标滚轮的操 阻尼因子,值的范围是[0, 1],当 BetterScroll 滚出边界的时候,需要施加阻力,防止滚动幅度过大,值越小,阻力越大。 +:::tip +当 mouseWheel 配置为 true 的时候,插件内部使用的是默认的插件选项对象。 + +```js +const bs = new BScroll('.wrapper', { + mouseWheel: true +}) + +// 相当于 + +const bs = new BScroll('.wrapper', { + mouseWheel: { + speed: 20, + invert: false, + easeTime: 300, + discreteTime: 400, + throttleTime: 0, + dampingFactor: 0.1 + } +}) +``` +::: + ## 事件 ### alterOptions From f8dbba67978b5532c0ea2abf5cc5642748caa2b9 Mon Sep 17 00:00:00 2001 From: theniceangel Date: Thu, 7 Jan 2021 10:14:03 +0800 Subject: [PATCH 06/25] docs(observe-image): optimize doc --- .../docs/en-US/plugins/observe-image.md | 18 ++++++++++++++++ .../docs/zh-CN/plugins/observe-image.md | 21 ++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/packages/vuepress-docs/docs/en-US/plugins/observe-image.md b/packages/vuepress-docs/docs/en-US/plugins/observe-image.md index 832dfcd9..d458dc2c 100644 --- a/packages/vuepress-docs/docs/en-US/plugins/observe-image.md +++ b/packages/vuepress-docs/docs/en-US/plugins/observe-image.md @@ -48,6 +48,24 @@ yarn add @better-scroll/observe-image ## observeImage Options +:::tip +When `observeImage` is configured as `true`, the plugin uses the default plugin option. + +```js +const bs = new BScroll('.wrapper', { + observeImage: true +}) + +// equals + +const bs = new BScroll('.wrapper', { + observeImage: { + debounceTime: 100 // ms + } +}) +``` +::: + ### debounceTime - **Type**: `number` diff --git a/packages/vuepress-docs/docs/zh-CN/plugins/observe-image.md b/packages/vuepress-docs/docs/zh-CN/plugins/observe-image.md index 290bbe3a..52b3f835 100644 --- a/packages/vuepress-docs/docs/zh-CN/plugins/observe-image.md +++ b/packages/vuepress-docs/docs/zh-CN/plugins/observe-image.md @@ -48,6 +48,24 @@ yarn add @better-scroll/observe-image ## observeImage 选项对象 +:::tip +当 observeImage 配置为 true 的时候,插件内部使用的是默认的插件选项对象。 + +```js +const bs = new BScroll('.wrapper', { + observeImage: true +}) + +// 相当于 + +const bs = new BScroll('.wrapper', { + observeImage: { + debounceTime: 100 // ms + } +}) +``` +::: + ### debounceTime - **类型:** `number` @@ -57,4 +75,5 @@ yarn add @better-scroll/observe-image :::tip 提示 当 debounceTime 为 0 的时候,会立马调用 **refresh** 方法,而不是使用 **setTimeout**。 - ::: \ No newline at end of file + ::: + \ No newline at end of file From 6d03295af117eda6419ea2ffd8b3b3be22675713 Mon Sep 17 00:00:00 2001 From: theniceangel Date: Thu, 7 Jan 2021 10:18:21 +0800 Subject: [PATCH 07/25] docs(pulldown): optimize docs --- .../docs/en-US/plugins/pulldown.md | 19 +++++++++++++++++++ .../docs/zh-CN/plugins/mouse-wheel.md | 2 +- .../docs/zh-CN/plugins/observe-image.md | 2 +- .../docs/zh-CN/plugins/pulldown.md | 19 +++++++++++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/packages/vuepress-docs/docs/en-US/plugins/pulldown.md b/packages/vuepress-docs/docs/en-US/plugins/pulldown.md index d7c5daa9..41b6f599 100644 --- a/packages/vuepress-docs/docs/en-US/plugins/pulldown.md +++ b/packages/vuepress-docs/docs/en-US/plugins/pulldown.md @@ -64,6 +64,25 @@ new BScroll('.bs-wrapper', { Rebound distance. After BetterScroll dispatches the `pullingDown` hook, it will immediately execute the rebound animation. +:::tip +When `pullDownRefresh` is configured as `true`, the plugin uses the default plugin option. + +```js +const bs = new BScroll('.wrapper', { + pullDownRefresh: true +}) + +// equals + +const bs = new BScroll('.wrapper', { + pullDownRefresh: { + threshold: 90, + stop: 40 + } +}) +``` +::: + ## Instance Methods :::tip diff --git a/packages/vuepress-docs/docs/zh-CN/plugins/mouse-wheel.md b/packages/vuepress-docs/docs/zh-CN/plugins/mouse-wheel.md index 8ebb36d0..ea83d82c 100644 --- a/packages/vuepress-docs/docs/zh-CN/plugins/mouse-wheel.md +++ b/packages/vuepress-docs/docs/zh-CN/plugins/mouse-wheel.md @@ -204,7 +204,7 @@ mouseWheel 插件还可以搭配其他的插件,为其增加鼠标滚轮的操 阻尼因子,值的范围是[0, 1],当 BetterScroll 滚出边界的时候,需要施加阻力,防止滚动幅度过大,值越小,阻力越大。 -:::tip +:::tip 提示 当 mouseWheel 配置为 true 的时候,插件内部使用的是默认的插件选项对象。 ```js diff --git a/packages/vuepress-docs/docs/zh-CN/plugins/observe-image.md b/packages/vuepress-docs/docs/zh-CN/plugins/observe-image.md index 52b3f835..411094b4 100644 --- a/packages/vuepress-docs/docs/zh-CN/plugins/observe-image.md +++ b/packages/vuepress-docs/docs/zh-CN/plugins/observe-image.md @@ -48,7 +48,7 @@ yarn add @better-scroll/observe-image ## observeImage 选项对象 -:::tip +:::tip 提示 当 observeImage 配置为 true 的时候,插件内部使用的是默认的插件选项对象。 ```js diff --git a/packages/vuepress-docs/docs/zh-CN/plugins/pulldown.md b/packages/vuepress-docs/docs/zh-CN/plugins/pulldown.md index cbf07018..74661889 100644 --- a/packages/vuepress-docs/docs/zh-CN/plugins/pulldown.md +++ b/packages/vuepress-docs/docs/zh-CN/plugins/pulldown.md @@ -64,6 +64,25 @@ new BScroll('.bs-wrapper', { 回弹悬停的距离。BetterScroll 在派发 `pullingDown` 钩子之后,会立马执行回弹悬停动画。 +:::tip 提示 +当 pullDownRefresh 配置为 true 的时候,插件内部使用的是默认的插件选项对象。 + +```js +const bs = new BScroll('.wrapper', { + pullDownRefresh: true +}) + +// 相当于 + +const bs = new BScroll('.wrapper', { + pullDownRefresh: { + threshold: 90, + stop: 40 + } +}) +``` +::: + ## 实例方法 :::tip 提示 From 1c1f3d0a97ac016e7ecc82199e1c769908edb8b0 Mon Sep 17 00:00:00 2001 From: theniceangel Date: Thu, 7 Jan 2021 10:25:11 +0800 Subject: [PATCH 08/25] docs(pullup): optimize docs --- .../vuepress-docs/docs/en-US/plugins/pullup.md | 18 ++++++++++++++++++ .../vuepress-docs/docs/zh-CN/plugins/pullup.md | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/packages/vuepress-docs/docs/en-US/plugins/pullup.md b/packages/vuepress-docs/docs/en-US/plugins/pullup.md index 542869c3..829f16b2 100644 --- a/packages/vuepress-docs/docs/en-US/plugins/pullup.md +++ b/packages/vuepress-docs/docs/en-US/plugins/pullup.md @@ -57,6 +57,24 @@ pass in the correct configuration in [options](./pullup.html#pullupload-options) The threshold for triggering a `pullingUp` hook. +:::tip +When `pullUpLoad` is configured as `true`, the plugin uses the default plugin option. + +```js +const bs = new BScroll('.wrapper', { + pullUpLoad: true +}) + +// equals + +const bs = new BScroll('.wrapper', { + pullUpLoad: { + threshold: 90 + } +}) +``` +::: + ## Instance Methods :::tip diff --git a/packages/vuepress-docs/docs/zh-CN/plugins/pullup.md b/packages/vuepress-docs/docs/zh-CN/plugins/pullup.md index 527cc7e6..22698247 100644 --- a/packages/vuepress-docs/docs/zh-CN/plugins/pullup.md +++ b/packages/vuepress-docs/docs/zh-CN/plugins/pullup.md @@ -56,6 +56,24 @@ yarn add @better-scroll/pull-up 触发上拉事件的阈值。 +:::tip 提示 +当 pullUpLoad 配置为 true 的时候,插件内部使用的是默认的插件选项对象。 + +```js +const bs = new BScroll('.wrapper', { + pullUpLoad: true +}) + +// 相当于 + +const bs = new BScroll('.wrapper', { + pullUpLoad: { + threshold: 90 + } +}) +``` +::: + ## 实例方法 :::tip 提示 From 0e3bdc30fb015d752ff03d1338a588294da225da Mon Sep 17 00:00:00 2001 From: theniceangel Date: Thu, 7 Jan 2021 10:27:24 +0800 Subject: [PATCH 09/25] docs(scrollbar): optimize docs --- .../docs/en-US/plugins/scroll-bar.md | 19 +++++++++++++++++++ .../docs/zh-CN/plugins/scroll-bar.md | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/packages/vuepress-docs/docs/en-US/plugins/scroll-bar.md b/packages/vuepress-docs/docs/en-US/plugins/scroll-bar.md index e10762aa..22c8f6e4 100644 --- a/packages/vuepress-docs/docs/en-US/plugins/scroll-bar.md +++ b/packages/vuepress-docs/docs/en-US/plugins/scroll-bar.md @@ -64,3 +64,22 @@ pass correct [scrollbar options](./scroll-bar.html#scrollbar-options) - **默认值**:`false` Whether scrollbar can interacted with. + +:::tip +When `scrollbar` is configured as `true`, the plugin uses the default plugin option. + +```js +const bs = new BScroll('.wrapper', { + scrollbar: true +}) + +// equals + +const bs = new BScroll('.wrapper', { + scrollbar: { + fade: true, + interactive: false + } +}) +``` +::: diff --git a/packages/vuepress-docs/docs/zh-CN/plugins/scroll-bar.md b/packages/vuepress-docs/docs/zh-CN/plugins/scroll-bar.md index 81f51fe7..dad4dcbf 100644 --- a/packages/vuepress-docs/docs/zh-CN/plugins/scroll-bar.md +++ b/packages/vuepress-docs/docs/zh-CN/plugins/scroll-bar.md @@ -63,3 +63,22 @@ yarn add @better-scroll/scroll-bar - **默认值**:`false` 滚动条是否可以交互。 + +:::tip 提示 +当 scrollbar 配置为 true 的时候,插件内部使用的是默认的插件选项对象。 + +```js +const bs = new BScroll('.wrapper', { + scrollbar: true +}) + +// 相当于 + +const bs = new BScroll('.wrapper', { + scrollbar: { + fade: true, + interactive: false + } +}) +``` +::: \ No newline at end of file From 4f03dff73f7fe5f50476387db15d65bfe6968f21 Mon Sep 17 00:00:00 2001 From: theniceangel Date: Thu, 7 Jan 2021 10:32:39 +0800 Subject: [PATCH 10/25] docs(slide): optimize docs --- .../vuepress-docs/docs/en-US/plugins/slide.md | 24 +++++++++++++++++++ .../vuepress-docs/docs/zh-CN/plugins/slide.md | 24 +++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/packages/vuepress-docs/docs/en-US/plugins/slide.md b/packages/vuepress-docs/docs/en-US/plugins/slide.md index 9b20928c..60652f86 100644 --- a/packages/vuepress-docs/docs/en-US/plugins/slide.md +++ b/packages/vuepress-docs/docs/en-US/plugins/slide.md @@ -174,6 +174,30 @@ In general, the layout of BetterScroll's slide is as follows: ## slide options +:::tip +When `slide` is configured as `true`, the plugin uses the default plugin option. + +```js +const bs = new BScroll('.wrapper', { + slide: true +}) + +// equals + +const bs = new BScroll('.wrapper', { + slide: { + loop: true, + threshold: 0.1, + speed: 400, + easing: ease.bounce, + listenFlick: true, + autoplay: true, + interval: 3000 + } +}) +``` +::: + ### loop - **Type**: `boolean` diff --git a/packages/vuepress-docs/docs/zh-CN/plugins/slide.md b/packages/vuepress-docs/docs/zh-CN/plugins/slide.md index 50dfa635..1a3b7456 100644 --- a/packages/vuepress-docs/docs/zh-CN/plugins/slide.md +++ b/packages/vuepress-docs/docs/zh-CN/plugins/slide.md @@ -174,6 +174,30 @@ yarn add @better-scroll/slide ## slide 选项对象 +:::tip 提示 +当 slide 配置为 true 的时候,插件内部使用的是默认的插件选项对象。 + +```js +const bs = new BScroll('.wrapper', { + slide: true +}) + +// 相当于 + +const bs = new BScroll('.wrapper', { + slide: { + loop: true, + threshold: 0.1, + speed: 400, + easing: ease.bounce, + listenFlick: true, + autoplay: true, + interval: 3000 + } +}) +``` +::: + ### loop - **类型**:`boolean` From 590a02221cf068108fc8f92c0c0c317cb5bfbf83 Mon Sep 17 00:00:00 2001 From: theniceangel Date: Thu, 7 Jan 2021 10:43:35 +0800 Subject: [PATCH 11/25] docs: optimize docs --- .../vuepress-docs/docs/en-US/plugins/slide.md | 8 +++--- .../vuepress-docs/docs/en-US/plugins/wheel.md | 25 ++++++++++++++++++- .../vuepress-docs/docs/en-US/plugins/zoom.md | 23 +++++++++++++++++ .../vuepress-docs/docs/zh-CN/FAQ/diagnosis.md | 2 +- .../vuepress-docs/docs/zh-CN/plugins/slide.md | 8 +++--- .../vuepress-docs/docs/zh-CN/plugins/wheel.md | 23 +++++++++++++++++ .../vuepress-docs/docs/zh-CN/plugins/zoom.md | 23 +++++++++++++++++ 7 files changed, 102 insertions(+), 10 deletions(-) diff --git a/packages/vuepress-docs/docs/en-US/plugins/slide.md b/packages/vuepress-docs/docs/en-US/plugins/slide.md index 60652f86..bb51e3da 100644 --- a/packages/vuepress-docs/docs/en-US/plugins/slide.md +++ b/packages/vuepress-docs/docs/en-US/plugins/slide.md @@ -379,10 +379,10 @@ bs.getCurrentPage() ### slidePageChanged(v2.1.0) - **Arguments**: `page` object - - `{ number } x`: The x value of the page to be displayed - - `{ number } y`: The y value of the page to be displayed - - `{ number } pageX`: The index value of the horizontal page to be displayed, the subscript starts from 0 - - `{ number } pageY`: The index value of the vertical page to be displayed, the subscript starts from 0 + - `{ number } x`: The x value of the current page + - `{ number } y`: The y value of the current page + - `{ number } pageX`: The index value of the horizontal page, the subscript starts from 0 + - `{ number } pageY`: The index value of the vertical page, the subscript starts from 0 - **Trigger timing**: When slide page has changed diff --git a/packages/vuepress-docs/docs/en-US/plugins/wheel.md b/packages/vuepress-docs/docs/en-US/plugins/wheel.md index e3d6cc81..97b9f60e 100644 --- a/packages/vuepress-docs/docs/en-US/plugins/wheel.md +++ b/packages/vuepress-docs/docs/en-US/plugins/wheel.md @@ -94,10 +94,33 @@ BetterScroll combined with the Wheel plugin is just the JS logic part of the Pic ## wheel options +:::tip +When `wheel` is configured as `true`, the plugin uses the default plugin option. + +```js +const bs = new BScroll('.wrapper', { + wheel: true +}) + +// equals + +const bs = new BScroll('.wrapper', { + wheel: { + wheelWrapperClass: 'wheel-scroll', + wheelItemClass: 'wheel-item', + rotate: 25, + adjustTime: 400, + selectedIndex: 0, + wheelDisabledItemClass: 'wheel-disabled-item' + } +}) +``` +::: + ### selectedIndex - **Type**: `number` - - **默认值**:`0` + - **Default**:`0` Instantiate the Wheel, the `selectedIndex` item is selected by default, and the index starts from 0. diff --git a/packages/vuepress-docs/docs/en-US/plugins/zoom.md b/packages/vuepress-docs/docs/en-US/plugins/zoom.md index 7bd3d7bf..ff471ec7 100644 --- a/packages/vuepress-docs/docs/en-US/plugins/zoom.md +++ b/packages/vuepress-docs/docs/en-US/plugins/zoom.md @@ -134,6 +134,29 @@ The following is related to `zoom` plugin and [BetterScroll configuration](../gu When the two fingers continue to zoom and the scale exceeds the threshold of `max`, when the two fingers leave, the internal "bounce" to the form of `max`, and `bounceTime` is the animation of this "bounce" behavior duration. +:::tip +When `zoom` is configured as `true`, the plugin uses the default plugin option. + +```js +const bs = new BScroll('.wrapper', { + zoom: true +}) + +// equals + +const bs = new BScroll('.wrapper', { + zoom: { + start: 1, + min: 1, + max: 4, + initialOrigin: [0, 0], + minimalZoomDistance: 5, + bounceTime: 800, // ms + } +}) +``` +::: + ## Instance Methods ### zoomTo(scale, x, y, [bounceTime]) diff --git a/packages/vuepress-docs/docs/zh-CN/FAQ/diagnosis.md b/packages/vuepress-docs/docs/zh-CN/FAQ/diagnosis.md index e4832572..52e5ca49 100644 --- a/packages/vuepress-docs/docs/zh-CN/FAQ/diagnosis.md +++ b/packages/vuepress-docs/docs/zh-CN/FAQ/diagnosis.md @@ -173,6 +173,6 @@ BetterScroll 提供了 `slide` 的 feature。如果实现了一个横向滚动 - **解决** - 主要是使用一个css特性`touch-action`,如果是横向的滑动,将`touch-action: pan-y`,这样就可以避免横向的切换触发浏览器的默认行为。 + 主要是使用一个 CSS 特性`touch-action`,如果是横向的滑动,将 `touch-action: pan-y` CSS 设置在 `wrapper` 上面,这样就可以避免横向的切换触发浏览器的默认行为。 diff --git a/packages/vuepress-docs/docs/zh-CN/plugins/slide.md b/packages/vuepress-docs/docs/zh-CN/plugins/slide.md index 1a3b7456..91f99a83 100644 --- a/packages/vuepress-docs/docs/zh-CN/plugins/slide.md +++ b/packages/vuepress-docs/docs/zh-CN/plugins/slide.md @@ -381,10 +381,10 @@ bs.getCurrentPage() ### slidePageChanged(v2.1.0) - **参数**:page 对象 - - `{ number } x`:即将展示页面的 x 坐标值 - - `{ number } y`:即将展示页面的 y 坐标值 - - `{ number } pageX`:即将展示的横向页面的索引值,下标从 0 开始 - - `{ number } pageY`:即将展示的纵向页面的索引值,下标从 0 开始 + - `{ number } x`:当前页面的 x 坐标值 + - `{ number } y`:当前页面的 y 坐标值 + - `{ number } pageX`:当前横向页面的索引值,下标从 0 开始 + - `{ number } pageY`:当前纵向页面的索引值,下标从 0 开始 - **触发时机**:当 slide 切换 page 之后触发 diff --git a/packages/vuepress-docs/docs/zh-CN/plugins/wheel.md b/packages/vuepress-docs/docs/zh-CN/plugins/wheel.md index 439a0a7d..50433bc1 100644 --- a/packages/vuepress-docs/docs/zh-CN/plugins/wheel.md +++ b/packages/vuepress-docs/docs/zh-CN/plugins/wheel.md @@ -94,6 +94,29 @@ BetterScroll 结合 wheel 插件只是实现 Picker 效果的 JS 逻辑部分, ## wheel 选项对象 +:::tip 提示 +当 wheel 配置为 true 的时候,插件内部使用的是默认的插件选项对象。 + +```js +const bs = new BScroll('.wrapper', { + wheel: true +}) + +// 相当于 + +const bs = new BScroll('.wrapper', { + wheel: { + wheelWrapperClass: 'wheel-scroll', + wheelItemClass: 'wheel-item', + rotate: 25, + adjustTime: 400, + selectedIndex: 0, + wheelDisabledItemClass: 'wheel-disabled-item' + } +}) +``` +::: + ### selectedIndex - **类型**:`number` diff --git a/packages/vuepress-docs/docs/zh-CN/plugins/zoom.md b/packages/vuepress-docs/docs/zh-CN/plugins/zoom.md index a7587dc5..279a67fd 100644 --- a/packages/vuepress-docs/docs/zh-CN/plugins/zoom.md +++ b/packages/vuepress-docs/docs/zh-CN/plugins/zoom.md @@ -134,6 +134,29 @@ new BScroll('.bs-wrapper', { 双指不断进行缩放操作并且 scale 超过 `max` 阈值的时候,当双指离开的时候,内部会「回弹」至 `max` 的形态,而 `bounceTime` 就是这次「回弹」行为的动画时长。 +:::tip 提示 +当 zoom 配置为 true 的时候,插件内部使用的是默认的插件选项对象。 + +```js +const bs = new BScroll('.wrapper', { + zoom: true +}) + +// 相当于 + +const bs = new BScroll('.wrapper', { + zoom: { + start: 1, + min: 1, + max: 4, + initialOrigin: [0, 0], + minimalZoomDistance: 5, + bounceTime: 800, // ms + } +}) +``` +::: + ## 实例方法 ### zoomTo(scale, x, y, [bounceTime]) From 7d02c3d2ba5c76c48ca605655cf376c0fbd05b92 Mon Sep 17 00:00:00 2001 From: theniceangel Date: Fri, 8 Jan 2021 23:00:23 +0800 Subject: [PATCH 12/25] chore: add logo url --- README.md | 6 +++++- README_zh-CN.md | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f507c479..06d54f9d 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # better-scroll - + [![npm version](https://img.shields.io/npm/v/better-scroll.svg)](https://www.npmjs.com/package/better-scroll) [![downloads](https://img.shields.io/npm/dm/better-scroll.svg)](https://www.npmjs.com/package/better-scroll) [![Build Status](https://travis-ci.org/ustbhuangyi/better-scroll.svg?branch=master)](https://travis-ci.org/ustbhuangyi/better-scroll) [![Package Quality](http://npm.packagequality.com/shield/better-scroll.svg)](http://packagequality.com/#?package=better-scroll) [![codecov.io](http://codecov.io/github/ustbhuangyi/better-scroll/coverage.svg?branch=master)](http://codecov.io/github/ustbhuangyi/better-scroll) @@ -66,6 +66,10 @@ let wrapper = document.getElementById("wrapper") let bs = new BScroll(wrapper, {}) ``` +## Wechat + + + ## What is BetterScroll ? BetterScroll is a plugin which is aimed at solving scrolling circumstances on the mobile side (PC supported already). The core is inspired by the implementation of [iscroll](https://github.com/cubiq/iscroll), so the APIs of BetterScroll are compatible with iscroll on the whole. What's more, BetterScroll also extends some features and optimizes for performance based on iscroll. diff --git a/README_zh-CN.md b/README_zh-CN.md index 2be35ef6..96e1cdb5 100755 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -1,5 +1,7 @@ # better-scroll + + [![npm version](https://img.shields.io/npm/v/better-scroll.svg)](https://www.npmjs.com/package/better-scroll) [![downloads](https://img.shields.io/npm/dm/better-scroll.svg)](https://www.npmjs.com/package/better-scroll) [![Build Status](https://travis-ci.org/ustbhuangyi/better-scroll.svg?branch=master)](https://travis-ci.org/ustbhuangyi/better-scroll) [![Package Quality](http://npm.packagequality.com/shield/better-scroll.svg)](http://packagequality.com/#?package=better-scroll) [![codecov.io](http://codecov.io/github/ustbhuangyi/better-scroll/coverage.svg?branch=master)](http://codecov.io/github/ustbhuangyi/better-scroll) [1.x Docs](https://better-scroll.github.io/docs-v1/) From 3bc47f42f98e72df1ca648378e4be06ef217f02c Mon Sep 17 00:00:00 2001 From: theniceangel Date: Tue, 12 Jan 2021 10:37:56 +0800 Subject: [PATCH 13/25] chore: update author info --- packages/better-scroll/package.json | 4 ++-- packages/core/package.json | 4 ++-- packages/examples/package.json | 4 ++-- packages/mouse-wheel/package.json | 5 ++++- packages/movable/package.json | 5 ++++- packages/nested-scroll/package.json | 4 ++-- packages/observe-dom/package.json | 5 ++++- packages/pull-down/package.json | 5 ++++- packages/pull-up/package.json | 5 ++++- packages/shared-utils/package.json | 5 ++++- packages/slide/package.json | 5 ++++- packages/wheel/package.json | 4 ++-- packages/zoom/package.json | 4 ++-- 13 files changed, 40 insertions(+), 19 deletions(-) diff --git a/packages/better-scroll/package.json b/packages/better-scroll/package.json index e4fc434d..d4b69191 100644 --- a/packages/better-scroll/package.json +++ b/packages/better-scroll/package.json @@ -3,8 +3,8 @@ "version": "2.1.2", "description": "Full-featured BetterScroll", "author": { - "name": "huangyi", - "email": "ustbhuangyi@gmail.com" + "name": "jizhi", + "email": "theniceangel@163.com" }, "publishConfig": { "access": "public" diff --git a/packages/core/package.json b/packages/core/package.json index 82a24d11..5a525499 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -3,8 +3,8 @@ "version": "2.1.2", "description": "Minimalistic core scrolling for BetterScroll, it is pure and tiny", "author": { - "name": "huangyi", - "email": "ustbhuangyi@gmail.com" + "name": "jizhi", + "email": "theniceangel@163.com" }, "publishConfig": { "access": "public" diff --git a/packages/examples/package.json b/packages/examples/package.json index 5937b7a9..53a64333 100644 --- a/packages/examples/package.json +++ b/packages/examples/package.json @@ -3,8 +3,8 @@ "version": "2.1.2", "description": "Examples of BetterScroll", "author": { - "name": "huangyi", - "email": "ustbhuangyi@gmail.com" + "name": "jizhi", + "email": "theniceangel@163.com" }, "private": true, "scripts": { diff --git a/packages/mouse-wheel/package.json b/packages/mouse-wheel/package.json index 2a305fd6..1c8f8a50 100644 --- a/packages/mouse-wheel/package.json +++ b/packages/mouse-wheel/package.json @@ -2,7 +2,10 @@ "name": "@better-scroll/mouse-wheel", "version": "2.1.2", "description": "support for MouseWheel in PC", - "author": "huangyi ", + "author": { + "name": "jizhi", + "email": "theniceangel@163.com" + }, "main": "dist/mouse-wheel.min.js", "module": "dist/mouse-wheel.esm.js", "typings": "dist/types/index.d.ts", diff --git a/packages/movable/package.json b/packages/movable/package.json index 747edd3e..36d74d65 100644 --- a/packages/movable/package.json +++ b/packages/movable/package.json @@ -2,7 +2,10 @@ "name": "@better-scroll/movable", "version": "2.1.2", "description": "Movable plugin for BetterScroll", - "author": "huangyi ", + "author": { + "name": "jizhi", + "email": "theniceangel@163.com" + }, "main": "dist/movable.min.js", "module": "dist/movable.esm.js", "typings": "dist/types/index.d.ts", diff --git a/packages/nested-scroll/package.json b/packages/nested-scroll/package.json index c21a7163..29ebe4b8 100644 --- a/packages/nested-scroll/package.json +++ b/packages/nested-scroll/package.json @@ -3,8 +3,8 @@ "version": "2.1.2", "description": "make your nested scrolls reconciliation", "author": { - "name": "huangyi", - "email": "ustbhuangyi@gmail.com" + "name": "jizhi", + "email": "theniceangel@163.com" }, "publishConfig": { "access": "public" diff --git a/packages/observe-dom/package.json b/packages/observe-dom/package.json index 8fcb488c..85573786 100644 --- a/packages/observe-dom/package.json +++ b/packages/observe-dom/package.json @@ -2,7 +2,10 @@ "name": "@better-scroll/observe-dom", "version": "2.1.2", "description": "Dynamic recalculating container's size for BetterScroll", - "author": "huangyi ", + "author": { + "name": "jizhi", + "email": "theniceangel@163.com" + }, "main": "dist/observe-dom.min.js", "module": "dist/observe-dom.esm.js", "typings": "dist/types/index.d.ts", diff --git a/packages/pull-down/package.json b/packages/pull-down/package.json index 029e9690..c1dbf3a4 100644 --- a/packages/pull-down/package.json +++ b/packages/pull-down/package.json @@ -2,7 +2,10 @@ "name": "@better-scroll/pull-down", "version": "2.1.2", "description": "pull down to refresh, behave likes App list refreshing", - "author": "huangyi ", + "author": { + "name": "jizhi", + "email": "theniceangel@163.com" + }, "main": "dist/pull-down.min.js", "module": "dist/pull-down.esm.js", "typings": "dist/types/index.d.ts", diff --git a/packages/pull-up/package.json b/packages/pull-up/package.json index 1ff99068..0fb8e829 100644 --- a/packages/pull-up/package.json +++ b/packages/pull-up/package.json @@ -2,7 +2,10 @@ "name": "@better-scroll/pull-up", "version": "2.1.2", "description": "pull up to load more data", - "author": "huangyi ", + "author": { + "name": "jizhi", + "email": "theniceangel@163.com" + }, "main": "dist/pull-up.min.js", "module": "dist/pull-up.esm.js", "typings": "dist/types/index.d.ts", diff --git a/packages/shared-utils/package.json b/packages/shared-utils/package.json index 70395552..f046380d 100644 --- a/packages/shared-utils/package.json +++ b/packages/shared-utils/package.json @@ -2,7 +2,10 @@ "name": "@better-scroll/shared-utils", "version": "2.1.2", "description": "shared-utils for BetterScroll", - "author": "huangyi ", + "author": { + "name": "jizhi", + "email": "theniceangel@163.com" + }, "main": "dist/shared-utils.min.js", "module": "dist/shared-utils.esm.js", "typings": "dist/types/index.d.ts", diff --git a/packages/slide/package.json b/packages/slide/package.json index 30a1c082..3503a537 100644 --- a/packages/slide/package.json +++ b/packages/slide/package.json @@ -2,7 +2,10 @@ "name": "@better-scroll/slide", "version": "2.1.2", "description": "a carousel effect triggered by BetterScroll", - "author": "huangyi ", + "author": { + "name": "jizhi", + "email": "theniceangel@163.com" + }, "main": "dist/slide.min.js", "module": "dist/slide.esm.js", "typings": "dist/types/index.d.ts", diff --git a/packages/wheel/package.json b/packages/wheel/package.json index 61ad786f..8a2da911 100644 --- a/packages/wheel/package.json +++ b/packages/wheel/package.json @@ -3,8 +3,8 @@ "version": "2.1.2", "description": "a BetterScroll plugin to imitate IOS Picker", "author": { - "name": "huangyi", - "email": "ustbhuangyi@gmail.com" + "name": "jizhi", + "email": "theniceangel@163.com" }, "main": "dist/wheel.min.js", "module": "dist/wheel.esm.js", diff --git a/packages/zoom/package.json b/packages/zoom/package.json index 7fade342..7bad95ba 100644 --- a/packages/zoom/package.json +++ b/packages/zoom/package.json @@ -3,8 +3,8 @@ "version": "2.1.2", "description": "a BetterScroll plugin to enlarge or narrow", "author": { - "name": "huangyi", - "email": "ustbhuangyi@gmail.com" + "name": "jizhi", + "email": "theniceangel@163.com" }, "main": "dist/zoom.min.js", "module": "dist/zoom.esm.js", From 6fe5187961283286c7578e53e503fd3a652b26ec Mon Sep 17 00:00:00 2001 From: jizhi Date: Sun, 17 Jan 2021 22:37:09 +0800 Subject: [PATCH 14/25] fix(scrollbar): fix typo --- packages/vuepress-docs/docs/en-US/plugins/scroll-bar.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/vuepress-docs/docs/en-US/plugins/scroll-bar.md b/packages/vuepress-docs/docs/en-US/plugins/scroll-bar.md index 22c8f6e4..f83aad0d 100644 --- a/packages/vuepress-docs/docs/en-US/plugins/scroll-bar.md +++ b/packages/vuepress-docs/docs/en-US/plugins/scroll-bar.md @@ -53,15 +53,15 @@ pass correct [scrollbar options](./scroll-bar.html#scrollbar-options) ### fade - - **类型**:`boolean` - - **默认值**:`true` + - **Type**: `boolean` + - **Default**: `true` When the scroll stops, the scrollbar fades out. ### interactive - - **类型**:`boolean` - - **默认值**:`false` + - **Type**: `boolean` + - **Default**: `false` Whether scrollbar can interacted with. From 9b77d4b363a72337084d2fb04313749377cd099c Mon Sep 17 00:00:00 2001 From: jizhi Date: Mon, 18 Jan 2021 21:20:10 +0800 Subject: [PATCH 15/25] docs: fix typo --- .../docs/en-US/guide/base-scroll-api.md | 20 ++++++++++--------- .../docs/zh-CN/guide/base-scroll-api.md | 8 ++++---- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/packages/vuepress-docs/docs/en-US/guide/base-scroll-api.md b/packages/vuepress-docs/docs/en-US/guide/base-scroll-api.md index 88d9139c..2cc00292 100644 --- a/packages/vuepress-docs/docs/en-US/guide/base-scroll-api.md +++ b/packages/vuepress-docs/docs/en-US/guide/base-scroll-api.md @@ -313,7 +313,7 @@ In 2.0, BetterScroll events are almost same with 1.x events. Only BetterScroll w ```typescript // bs version >= 2.0.4 bs.on('contentChanged', (newContent: HTMLElement) => {}) - ``` + ``` The following events must be registered for the **plugin** in parentheses to be dispatched: @@ -331,13 +331,15 @@ The following events must be registered for the **plugin** in parentheses to be bs.on('alterOptions', (mouseWheelOptions) => { /** - * mouseWheelOptions.speed:鼠标滚轮滚动的速度 - * mouseWheelOptions.invert:滚轮滚动和 BetterScroll 滚动的方向是否一致 - * mouseWheelOptions.easeTime:滚动动画的缓动时长。 - * mouseWheelOptions.discreteTime:触发 wheelEnd 的间隔时长 - * mouseWheelOptions.throttleTime:滚轮滚动是高频率的动作,因此可以通过 throttleTime 来限制触发频率 - * mouseWheelOptions.dampingFactor:阻尼因子,当超出边界会施加阻力 + * mouseWheelOptions.speed + * mouseWheelOptions.invert + * mouseWheelOptions.easeTime + * mouseWheelOptions.discreteTime + * mouseWheelOptions.throttleTime + * mouseWheelOptions.dampingFactor **/ + + // please see details in mouse-wheel plugin doc }) ``` @@ -522,7 +524,7 @@ A hook is a concept extended from version 2.0. Its essence is the same as an eve const bs = new BScroll('.wrapper', {}) bs.hooks.on('destroy', () => { console.log('destroyed') }) ``` - + - **contentChanged**(2.0.4) - **Trigger timing**:When calling `bs.refresh()`, it is detected that the content DOM has become other elements - **Usage** @@ -532,7 +534,7 @@ A hook is a concept extended from version 2.0. Its essence is the same as an eve // bs version >= 2.0.4 bs.hooks.on('contentChanged', (newContent: HTMLElement) => { console.log(newContent) }) ``` - + - **ActionsHandler.hooks** diff --git a/packages/vuepress-docs/docs/zh-CN/guide/base-scroll-api.md b/packages/vuepress-docs/docs/zh-CN/guide/base-scroll-api.md index 192b97a6..7bd8cc31 100644 --- a/packages/vuepress-docs/docs/zh-CN/guide/base-scroll-api.md +++ b/packages/vuepress-docs/docs/zh-CN/guide/base-scroll-api.md @@ -27,12 +27,12 @@ ### maxScrollY - **类型**:number - **作用**:bs 最大纵向滚动位置。 - - **备注**:bs 纵向滚动的位置区间是 [minScrollY, maxScrollY],并且 maxScrollY 是负值,maxScrollY 是正值。 + - **备注**:bs 纵向滚动的位置区间是 [minScrollY, maxScrollY],并且 maxScrollY 是负值。 ### minScrollY - **类型**:number - **作用**:bs 最小纵向滚动位置。 - - **备注**:bs 纵向滚动的位置区间是 [minScrollY, maxScrollY],并且 minScrollY 是正值 + - **备注**:bs 纵向滚动的位置区间是 [minScrollY, maxScrollY],并且 minScrollY 是正值。 ### movingDirectionX - **类型**:number @@ -312,7 +312,7 @@ BetterScroll 提供了很多灵活的 API,当我们基于 BetterScroll 去实 ```typescript // bs 版本 >= 2.0.4 bs.on('contentChanged', (newContent: HTMLElement) => {}) - ``` + ``` 以下的事件必须注册括号中的**插件**才会派发: @@ -531,7 +531,7 @@ BetterScroll 提供了很多灵活的 API,当我们基于 BetterScroll 去实 // bs 版本 >= 2.0.4 bs.hooks.on('contentChanged', (newContent: HTMLElement) => { console.log(newContent) }) ``` - + - **ActionsHandler.hooks** - **beforeStart** From 0ac335b3a3b0cd0df4622a51fe8fada125793539 Mon Sep 17 00:00:00 2001 From: chenyulun Date: Thu, 21 Jan 2021 23:07:20 +0800 Subject: [PATCH 16/25] fix(shared-utils): add touchcancel trigger the end event hook --- .../core/src/__tests__/__utils__/event.ts | 7 ++++++ .../src/base/__tests__/ActionsHandler.spec.ts | 22 +++++++++++++++++-- packages/shared-utils/src/dom.ts | 2 ++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/packages/core/src/__tests__/__utils__/event.ts b/packages/core/src/__tests__/__utils__/event.ts index 044663bb..5c5ba4bb 100644 --- a/packages/core/src/__tests__/__utils__/event.ts +++ b/packages/core/src/__tests__/__utils__/event.ts @@ -65,6 +65,13 @@ export function dispatchTouchEnd( dispatchTouch(target, 'touchend', touches) } +export function dispatchTouchCancel( + target: EventTarget, + touches: CustomTouches +): void { + dispatchTouch(target, 'touchcancel', touches) +} + export function dispatchSwipe( target: EventTarget, touches: CustomTouches, diff --git a/packages/core/src/base/__tests__/ActionsHandler.spec.ts b/packages/core/src/base/__tests__/ActionsHandler.spec.ts index c38fc9b5..57028f7c 100644 --- a/packages/core/src/base/__tests__/ActionsHandler.spec.ts +++ b/packages/core/src/base/__tests__/ActionsHandler.spec.ts @@ -4,6 +4,9 @@ import ActionsHandler, { import { dispatchTouch, dispatchMouse, + dispatchTouchStart, + dispatchTouchEnd, + dispatchTouchCancel, } from '@better-scroll/core/src/__tests__/__utils__/event' describe('ActionsHandler', () => { @@ -121,9 +124,24 @@ describe('ActionsHandler', () => { actionsHandler.hooks.on('end', endMockHandler) - dispatchMouse(wrapper, 'mousedown') + dispatchTouchStart(wrapper, [{ pageX: 0, pageY: 0 }]) + + dispatchTouchEnd(window, [{ pageX: 0, pageY: 0 }]) + + expect(endMockHandler).toBeCalled() + }) + + it('should invoke end method when dispatch touchcancel', () => { + actionsHandler = new ActionsHandler(wrapper, options) + const endMockHandler = jest.fn().mockImplementation(() => { + return 'dummy test' + }) + + actionsHandler.hooks.on('end', endMockHandler) + + dispatchTouchStart(wrapper, [{ pageX: 0, pageY: 0 }]) - dispatchMouse(window, 'mouseup') + dispatchTouchCancel(window, [{ pageX: 0, pageY: 0 }]) expect(endMockHandler).toBeCalled() }) diff --git a/packages/shared-utils/src/dom.ts b/packages/shared-utils/src/dom.ts index d62af2e5..644cacf2 100755 --- a/packages/shared-utils/src/dom.ts +++ b/packages/shared-utils/src/dom.ts @@ -150,6 +150,7 @@ export const eventTypeMap: { touchstart: number touchmove: number touchend: number + touchcancel: number mousedown: number mousemove: number mouseup: number @@ -157,6 +158,7 @@ export const eventTypeMap: { touchstart: 1, touchmove: 1, touchend: 1, + touchcancel: 1, mousedown: 2, mousemove: 2, From 7ddb74ac186e7976f572a85ca2b30b69a88f0b1c Mon Sep 17 00:00:00 2001 From: jizhi Date: Fri, 22 Jan 2021 01:12:10 +0800 Subject: [PATCH 17/25] v2.1.3 --- lerna.json | 2 +- packages/better-scroll/package.json | 28 ++++++++++++++-------------- packages/core/package.json | 4 ++-- packages/examples/package.json | 2 +- packages/infinity/package.json | 4 ++-- packages/mouse-wheel/package.json | 4 ++-- packages/movable/package.json | 4 ++-- packages/nested-scroll/package.json | 4 ++-- packages/observe-dom/package.json | 4 ++-- packages/observe-image/package.json | 4 ++-- packages/pull-down/package.json | 4 ++-- packages/pull-up/package.json | 4 ++-- packages/scroll-bar/package.json | 4 ++-- packages/shared-utils/package.json | 8 ++++---- packages/slide/package.json | 10 +++++----- packages/vuepress-docs/package.json | 2 +- packages/wheel/package.json | 4 ++-- packages/zoom/package.json | 4 ++-- 18 files changed, 50 insertions(+), 50 deletions(-) diff --git a/lerna.json b/lerna.json index 4c57da00..92eb9ef9 100644 --- a/lerna.json +++ b/lerna.json @@ -4,5 +4,5 @@ "packages": [ "packages/*" ], - "version": "2.1.2" + "version": "2.1.3" } diff --git a/packages/better-scroll/package.json b/packages/better-scroll/package.json index d4b69191..9866762f 100644 --- a/packages/better-scroll/package.json +++ b/packages/better-scroll/package.json @@ -1,6 +1,6 @@ { "name": "better-scroll", - "version": "2.1.2", + "version": "2.1.3", "description": "Full-featured BetterScroll", "author": { "name": "jizhi", @@ -31,19 +31,19 @@ "directory": "packages/better-scroll" }, "dependencies": { - "@better-scroll/core": "^2.1.2", - "@better-scroll/infinity": "^2.1.2", - "@better-scroll/mouse-wheel": "^2.1.2", - "@better-scroll/movable": "^2.1.2", - "@better-scroll/nested-scroll": "^2.1.2", - "@better-scroll/observe-dom": "^2.1.2", - "@better-scroll/observe-image": "^2.1.2", - "@better-scroll/pull-down": "^2.1.2", - "@better-scroll/pull-up": "^2.1.2", - "@better-scroll/scroll-bar": "^2.1.2", - "@better-scroll/slide": "^2.1.2", - "@better-scroll/wheel": "^2.1.2", - "@better-scroll/zoom": "^2.1.2" + "@better-scroll/core": "^2.1.3", + "@better-scroll/infinity": "^2.1.3", + "@better-scroll/mouse-wheel": "^2.1.3", + "@better-scroll/movable": "^2.1.3", + "@better-scroll/nested-scroll": "^2.1.3", + "@better-scroll/observe-dom": "^2.1.3", + "@better-scroll/observe-image": "^2.1.3", + "@better-scroll/pull-down": "^2.1.3", + "@better-scroll/pull-up": "^2.1.3", + "@better-scroll/scroll-bar": "^2.1.3", + "@better-scroll/slide": "^2.1.3", + "@better-scroll/wheel": "^2.1.3", + "@better-scroll/zoom": "^2.1.3" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/core/package.json b/packages/core/package.json index 5a525499..d594d8f2 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/core", - "version": "2.1.2", + "version": "2.1.3", "description": "Minimalistic core scrolling for BetterScroll, it is pure and tiny", "author": { "name": "jizhi", @@ -31,7 +31,7 @@ "directory": "packages/core" }, "dependencies": { - "@better-scroll/shared-utils": "^2.1.2" + "@better-scroll/shared-utils": "^2.1.3" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/examples/package.json b/packages/examples/package.json index 53a64333..433c2100 100644 --- a/packages/examples/package.json +++ b/packages/examples/package.json @@ -1,6 +1,6 @@ { "name": "examples", - "version": "2.1.2", + "version": "2.1.3", "description": "Examples of BetterScroll", "author": { "name": "jizhi", diff --git a/packages/infinity/package.json b/packages/infinity/package.json index c1c8f539..9cdd5bd2 100644 --- a/packages/infinity/package.json +++ b/packages/infinity/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/infinity", - "version": "2.1.2", + "version": "2.1.3", "description": "The ability to inject a infinity load for BetterScroll.", "author": "fengweiyao ", "main": "dist/infinity.min.js", @@ -27,7 +27,7 @@ "directory": "packages/infinity" }, "dependencies": { - "@better-scroll/core": "^2.1.2" + "@better-scroll/core": "^2.1.3" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/mouse-wheel/package.json b/packages/mouse-wheel/package.json index 1c8f8a50..377e3a69 100644 --- a/packages/mouse-wheel/package.json +++ b/packages/mouse-wheel/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/mouse-wheel", - "version": "2.1.2", + "version": "2.1.3", "description": "support for MouseWheel in PC", "author": { "name": "jizhi", @@ -30,7 +30,7 @@ "directory": "packages/mouse-wheel" }, "dependencies": { - "@better-scroll/core": "^2.1.2" + "@better-scroll/core": "^2.1.3" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/movable/package.json b/packages/movable/package.json index 36d74d65..86befbc3 100644 --- a/packages/movable/package.json +++ b/packages/movable/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/movable", - "version": "2.1.2", + "version": "2.1.3", "description": "Movable plugin for BetterScroll", "author": { "name": "jizhi", @@ -30,6 +30,6 @@ "directory": "packages/observe-dom" }, "dependencies": { - "@better-scroll/core": "^2.1.2" + "@better-scroll/core": "^2.1.3" } } diff --git a/packages/nested-scroll/package.json b/packages/nested-scroll/package.json index 29ebe4b8..15036a76 100644 --- a/packages/nested-scroll/package.json +++ b/packages/nested-scroll/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/nested-scroll", - "version": "2.1.2", + "version": "2.1.3", "description": "make your nested scrolls reconciliation", "author": { "name": "jizhi", @@ -31,7 +31,7 @@ "directory": "packages/nested-scroll" }, "dependencies": { - "@better-scroll/core": "^2.1.2" + "@better-scroll/core": "^2.1.3" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/observe-dom/package.json b/packages/observe-dom/package.json index 85573786..d51dfe61 100644 --- a/packages/observe-dom/package.json +++ b/packages/observe-dom/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/observe-dom", - "version": "2.1.2", + "version": "2.1.3", "description": "Dynamic recalculating container's size for BetterScroll", "author": { "name": "jizhi", @@ -30,7 +30,7 @@ "directory": "packages/observe-dom" }, "dependencies": { - "@better-scroll/core": "^2.1.2" + "@better-scroll/core": "^2.1.3" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/observe-image/package.json b/packages/observe-image/package.json index 6888447e..ad2aa001 100644 --- a/packages/observe-image/package.json +++ b/packages/observe-image/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/observe-image", - "version": "2.1.2", + "version": "2.1.3", "description": "Observe image loading for BetterScroll", "author": "theniceangel ", "homepage": "https://github.com/ustbhuangyi/better-scroll/tree/master/packages/observe-image#readme", @@ -28,6 +28,6 @@ "url": "https://github.com/ustbhuangyi/better-scroll/issues" }, "dependencies": { - "@better-scroll/core": "^2.1.2" + "@better-scroll/core": "^2.1.3" } } diff --git a/packages/pull-down/package.json b/packages/pull-down/package.json index c1dbf3a4..f4c4d527 100644 --- a/packages/pull-down/package.json +++ b/packages/pull-down/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/pull-down", - "version": "2.1.2", + "version": "2.1.3", "description": "pull down to refresh, behave likes App list refreshing", "author": { "name": "jizhi", @@ -31,7 +31,7 @@ "directory": "packages/pull-down" }, "dependencies": { - "@better-scroll/core": "^2.1.2" + "@better-scroll/core": "^2.1.3" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/pull-up/package.json b/packages/pull-up/package.json index 0fb8e829..2d73c7dc 100644 --- a/packages/pull-up/package.json +++ b/packages/pull-up/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/pull-up", - "version": "2.1.2", + "version": "2.1.3", "description": "pull up to load more data", "author": { "name": "jizhi", @@ -30,7 +30,7 @@ "directory": "packages/pull-up" }, "dependencies": { - "@better-scroll/core": "^2.1.2" + "@better-scroll/core": "^2.1.3" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/scroll-bar/package.json b/packages/scroll-bar/package.json index a6685132..bbb16945 100644 --- a/packages/scroll-bar/package.json +++ b/packages/scroll-bar/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/scroll-bar", - "version": "2.1.2", + "version": "2.1.3", "description": "scrollbar is used to BetterScroll, which behaves like browser scrollbar", "author": "huangyi ", "main": "dist/scroll-bar.min.js", @@ -27,7 +27,7 @@ "directory": "packages/scroll-bar" }, "dependencies": { - "@better-scroll/core": "^2.1.2" + "@better-scroll/core": "^2.1.3" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/shared-utils/package.json b/packages/shared-utils/package.json index f046380d..0e1b2a0f 100644 --- a/packages/shared-utils/package.json +++ b/packages/shared-utils/package.json @@ -1,11 +1,11 @@ { "name": "@better-scroll/shared-utils", - "version": "2.1.2", + "version": "2.1.3", "description": "shared-utils for BetterScroll", "author": { - "name": "jizhi", - "email": "theniceangel@163.com" - }, + "name": "jizhi", + "email": "theniceangel@163.com" + }, "main": "dist/shared-utils.min.js", "module": "dist/shared-utils.esm.js", "typings": "dist/types/index.d.ts", diff --git a/packages/slide/package.json b/packages/slide/package.json index 3503a537..9ed8a3f8 100644 --- a/packages/slide/package.json +++ b/packages/slide/package.json @@ -1,11 +1,11 @@ { "name": "@better-scroll/slide", - "version": "2.1.2", + "version": "2.1.3", "description": "a carousel effect triggered by BetterScroll", "author": { - "name": "jizhi", - "email": "theniceangel@163.com" - }, + "name": "jizhi", + "email": "theniceangel@163.com" + }, "main": "dist/slide.min.js", "module": "dist/slide.esm.js", "typings": "dist/types/index.d.ts", @@ -30,7 +30,7 @@ "directory": "packages/slide" }, "dependencies": { - "@better-scroll/core": "^2.1.2" + "@better-scroll/core": "^2.1.3" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/vuepress-docs/package.json b/packages/vuepress-docs/package.json index 7689223c..498d351e 100644 --- a/packages/vuepress-docs/package.json +++ b/packages/vuepress-docs/package.json @@ -1,6 +1,6 @@ { "name": "vuepress-docs", - "version": "2.1.2", + "version": "2.1.3", "description": "Docs of BetterScroll", "author": { "name": "huangyi", diff --git a/packages/wheel/package.json b/packages/wheel/package.json index 8a2da911..a215f913 100644 --- a/packages/wheel/package.json +++ b/packages/wheel/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/wheel", - "version": "2.1.2", + "version": "2.1.3", "description": "a BetterScroll plugin to imitate IOS Picker", "author": { "name": "jizhi", @@ -29,7 +29,7 @@ "url": "git@github.com:ustbhuangyi/better-scroll.git" }, "dependencies": { - "@better-scroll/core": "^2.1.2" + "@better-scroll/core": "^2.1.3" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/zoom/package.json b/packages/zoom/package.json index 7bad95ba..ec1d15a6 100644 --- a/packages/zoom/package.json +++ b/packages/zoom/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/zoom", - "version": "2.1.2", + "version": "2.1.3", "description": "a BetterScroll plugin to enlarge or narrow", "author": { "name": "jizhi", @@ -32,7 +32,7 @@ "directory": "packages/zoom" }, "dependencies": { - "@better-scroll/core": "^2.1.2" + "@better-scroll/core": "^2.1.3" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } From 1230824247f2b6aa7a35f7112acd3c34fd8e5545 Mon Sep 17 00:00:00 2001 From: jizhi Date: Sun, 24 Jan 2021 16:30:14 +0800 Subject: [PATCH 18/25] fix(nested-scroll): fix horizontal-in-vertical scrolls when horizontal scroll is moved in vertical direction, don't disable parent vertical scroll --- packages/nested-scroll/src/index.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/nested-scroll/src/index.ts b/packages/nested-scroll/src/index.ts index 5bb9ad3c..440ffb62 100644 --- a/packages/nested-scroll/src/index.ts +++ b/packages/nested-scroll/src/index.ts @@ -52,9 +52,14 @@ const enableScrollHander = (scrolls: BScroll[]) => { }) } -const disableScrollHander = (scrolls: BScroll[]) => { +const disableScrollHander = (scrolls: BScroll[], currentScroll: BScroll) => { scrolls.forEach((scroll) => { - scroll.disable() + if ( + scroll.hasHorizontalScroll === currentScroll.hasHorizontalScroll || + scroll.hasVerticalScroll === currentScroll.hasVerticalScroll + ) { + scroll.disable() + } }) } @@ -306,7 +311,7 @@ export default class NestedScroll implements PluginAPI { resetPositionHandler(currentScroll) } syncTouchstartData(ancestorScrolls) - disableScrollHander(ancestorScrolls) + disableScrollHander(ancestorScrolls, currentScroll) } const touchEndHandler = () => { @@ -343,14 +348,14 @@ export default class NestedScroll implements PluginAPI { const contentMoved = currentScroll.scroller.actions.contentMoved const isTopScroll = ancestorScrolls.length === 0 if (contentMoved) { - disableScrollHander(ancestorScrolls) + disableScrollHander(ancestorScrolls, currentScroll) } else if (!isTopScroll) { if (isOutOfBoundary(currentScroll)) { - disableScrollHander([currentScroll]) + disableScrollHander([currentScroll], currentScroll) if (parentScroll) { enableScrollHander([parentScroll]) } - disableScrollHander(otherAncestorScrolls) + disableScrollHander(otherAncestorScrolls, currentScroll) return true } } From 1a751ce178f86a353193c94518e840a4b0f4856c Mon Sep 17 00:00:00 2001 From: jizhi Date: Sun, 24 Jan 2021 16:36:17 +0800 Subject: [PATCH 19/25] test(nested-scroll): fix test --- packages/nested-scroll/src/__tests__/index.spec.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/nested-scroll/src/__tests__/index.spec.ts b/packages/nested-scroll/src/__tests__/index.spec.ts index 02251567..77a46793 100644 --- a/packages/nested-scroll/src/__tests__/index.spec.ts +++ b/packages/nested-scroll/src/__tests__/index.spec.ts @@ -231,6 +231,10 @@ describe('NestedScroll tests', () => { hasVerticalScroll: false, hasHorizontalScroll: true, }) + addProperties(grandsonScrollH, { + hasVerticalScroll: false, + hasHorizontalScroll: true, + }) grandsonScrollH.trigger(grandsonScrollH.eventTypes.beforeScrollStart) expect(parentScrollH.disable).toBeCalled() From 737e9cd6b17808e97b309b66e293b39334fc7b97 Mon Sep 17 00:00:00 2001 From: jizhi Date: Sun, 24 Jan 2021 16:47:39 +0800 Subject: [PATCH 20/25] v2.1.4 --- lerna.json | 2 +- packages/better-scroll/package.json | 28 ++++++++++++++-------------- packages/core/package.json | 4 ++-- packages/examples/package.json | 2 +- packages/infinity/package.json | 4 ++-- packages/mouse-wheel/package.json | 4 ++-- packages/movable/package.json | 4 ++-- packages/nested-scroll/package.json | 4 ++-- packages/observe-dom/package.json | 4 ++-- packages/observe-image/package.json | 4 ++-- packages/pull-down/package.json | 4 ++-- packages/pull-up/package.json | 4 ++-- packages/scroll-bar/package.json | 4 ++-- packages/shared-utils/package.json | 2 +- packages/slide/package.json | 4 ++-- packages/vuepress-docs/package.json | 2 +- packages/wheel/package.json | 4 ++-- packages/zoom/package.json | 4 ++-- 18 files changed, 44 insertions(+), 44 deletions(-) diff --git a/lerna.json b/lerna.json index 92eb9ef9..d0c673cf 100644 --- a/lerna.json +++ b/lerna.json @@ -4,5 +4,5 @@ "packages": [ "packages/*" ], - "version": "2.1.3" + "version": "2.1.4" } diff --git a/packages/better-scroll/package.json b/packages/better-scroll/package.json index 9866762f..a15a9180 100644 --- a/packages/better-scroll/package.json +++ b/packages/better-scroll/package.json @@ -1,6 +1,6 @@ { "name": "better-scroll", - "version": "2.1.3", + "version": "2.1.4", "description": "Full-featured BetterScroll", "author": { "name": "jizhi", @@ -31,19 +31,19 @@ "directory": "packages/better-scroll" }, "dependencies": { - "@better-scroll/core": "^2.1.3", - "@better-scroll/infinity": "^2.1.3", - "@better-scroll/mouse-wheel": "^2.1.3", - "@better-scroll/movable": "^2.1.3", - "@better-scroll/nested-scroll": "^2.1.3", - "@better-scroll/observe-dom": "^2.1.3", - "@better-scroll/observe-image": "^2.1.3", - "@better-scroll/pull-down": "^2.1.3", - "@better-scroll/pull-up": "^2.1.3", - "@better-scroll/scroll-bar": "^2.1.3", - "@better-scroll/slide": "^2.1.3", - "@better-scroll/wheel": "^2.1.3", - "@better-scroll/zoom": "^2.1.3" + "@better-scroll/core": "^2.1.4", + "@better-scroll/infinity": "^2.1.4", + "@better-scroll/mouse-wheel": "^2.1.4", + "@better-scroll/movable": "^2.1.4", + "@better-scroll/nested-scroll": "^2.1.4", + "@better-scroll/observe-dom": "^2.1.4", + "@better-scroll/observe-image": "^2.1.4", + "@better-scroll/pull-down": "^2.1.4", + "@better-scroll/pull-up": "^2.1.4", + "@better-scroll/scroll-bar": "^2.1.4", + "@better-scroll/slide": "^2.1.4", + "@better-scroll/wheel": "^2.1.4", + "@better-scroll/zoom": "^2.1.4" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/core/package.json b/packages/core/package.json index d594d8f2..c54ad0ab 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/core", - "version": "2.1.3", + "version": "2.1.4", "description": "Minimalistic core scrolling for BetterScroll, it is pure and tiny", "author": { "name": "jizhi", @@ -31,7 +31,7 @@ "directory": "packages/core" }, "dependencies": { - "@better-scroll/shared-utils": "^2.1.3" + "@better-scroll/shared-utils": "^2.1.4" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/examples/package.json b/packages/examples/package.json index 433c2100..88cb2ef3 100644 --- a/packages/examples/package.json +++ b/packages/examples/package.json @@ -1,6 +1,6 @@ { "name": "examples", - "version": "2.1.3", + "version": "2.1.4", "description": "Examples of BetterScroll", "author": { "name": "jizhi", diff --git a/packages/infinity/package.json b/packages/infinity/package.json index 9cdd5bd2..2d6f1ee7 100644 --- a/packages/infinity/package.json +++ b/packages/infinity/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/infinity", - "version": "2.1.3", + "version": "2.1.4", "description": "The ability to inject a infinity load for BetterScroll.", "author": "fengweiyao ", "main": "dist/infinity.min.js", @@ -27,7 +27,7 @@ "directory": "packages/infinity" }, "dependencies": { - "@better-scroll/core": "^2.1.3" + "@better-scroll/core": "^2.1.4" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/mouse-wheel/package.json b/packages/mouse-wheel/package.json index 377e3a69..ca76f050 100644 --- a/packages/mouse-wheel/package.json +++ b/packages/mouse-wheel/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/mouse-wheel", - "version": "2.1.3", + "version": "2.1.4", "description": "support for MouseWheel in PC", "author": { "name": "jizhi", @@ -30,7 +30,7 @@ "directory": "packages/mouse-wheel" }, "dependencies": { - "@better-scroll/core": "^2.1.3" + "@better-scroll/core": "^2.1.4" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/movable/package.json b/packages/movable/package.json index 86befbc3..4083c5de 100644 --- a/packages/movable/package.json +++ b/packages/movable/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/movable", - "version": "2.1.3", + "version": "2.1.4", "description": "Movable plugin for BetterScroll", "author": { "name": "jizhi", @@ -30,6 +30,6 @@ "directory": "packages/observe-dom" }, "dependencies": { - "@better-scroll/core": "^2.1.3" + "@better-scroll/core": "^2.1.4" } } diff --git a/packages/nested-scroll/package.json b/packages/nested-scroll/package.json index 15036a76..4c1891e8 100644 --- a/packages/nested-scroll/package.json +++ b/packages/nested-scroll/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/nested-scroll", - "version": "2.1.3", + "version": "2.1.4", "description": "make your nested scrolls reconciliation", "author": { "name": "jizhi", @@ -31,7 +31,7 @@ "directory": "packages/nested-scroll" }, "dependencies": { - "@better-scroll/core": "^2.1.3" + "@better-scroll/core": "^2.1.4" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/observe-dom/package.json b/packages/observe-dom/package.json index d51dfe61..f0d871d7 100644 --- a/packages/observe-dom/package.json +++ b/packages/observe-dom/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/observe-dom", - "version": "2.1.3", + "version": "2.1.4", "description": "Dynamic recalculating container's size for BetterScroll", "author": { "name": "jizhi", @@ -30,7 +30,7 @@ "directory": "packages/observe-dom" }, "dependencies": { - "@better-scroll/core": "^2.1.3" + "@better-scroll/core": "^2.1.4" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/observe-image/package.json b/packages/observe-image/package.json index ad2aa001..c7f4e2a9 100644 --- a/packages/observe-image/package.json +++ b/packages/observe-image/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/observe-image", - "version": "2.1.3", + "version": "2.1.4", "description": "Observe image loading for BetterScroll", "author": "theniceangel ", "homepage": "https://github.com/ustbhuangyi/better-scroll/tree/master/packages/observe-image#readme", @@ -28,6 +28,6 @@ "url": "https://github.com/ustbhuangyi/better-scroll/issues" }, "dependencies": { - "@better-scroll/core": "^2.1.3" + "@better-scroll/core": "^2.1.4" } } diff --git a/packages/pull-down/package.json b/packages/pull-down/package.json index f4c4d527..34ad4bf5 100644 --- a/packages/pull-down/package.json +++ b/packages/pull-down/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/pull-down", - "version": "2.1.3", + "version": "2.1.4", "description": "pull down to refresh, behave likes App list refreshing", "author": { "name": "jizhi", @@ -31,7 +31,7 @@ "directory": "packages/pull-down" }, "dependencies": { - "@better-scroll/core": "^2.1.3" + "@better-scroll/core": "^2.1.4" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/pull-up/package.json b/packages/pull-up/package.json index 2d73c7dc..4c02d284 100644 --- a/packages/pull-up/package.json +++ b/packages/pull-up/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/pull-up", - "version": "2.1.3", + "version": "2.1.4", "description": "pull up to load more data", "author": { "name": "jizhi", @@ -30,7 +30,7 @@ "directory": "packages/pull-up" }, "dependencies": { - "@better-scroll/core": "^2.1.3" + "@better-scroll/core": "^2.1.4" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/scroll-bar/package.json b/packages/scroll-bar/package.json index bbb16945..35b23fdd 100644 --- a/packages/scroll-bar/package.json +++ b/packages/scroll-bar/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/scroll-bar", - "version": "2.1.3", + "version": "2.1.4", "description": "scrollbar is used to BetterScroll, which behaves like browser scrollbar", "author": "huangyi ", "main": "dist/scroll-bar.min.js", @@ -27,7 +27,7 @@ "directory": "packages/scroll-bar" }, "dependencies": { - "@better-scroll/core": "^2.1.3" + "@better-scroll/core": "^2.1.4" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/shared-utils/package.json b/packages/shared-utils/package.json index 0e1b2a0f..aa4e51a4 100644 --- a/packages/shared-utils/package.json +++ b/packages/shared-utils/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/shared-utils", - "version": "2.1.3", + "version": "2.1.4", "description": "shared-utils for BetterScroll", "author": { "name": "jizhi", diff --git a/packages/slide/package.json b/packages/slide/package.json index 9ed8a3f8..b7790418 100644 --- a/packages/slide/package.json +++ b/packages/slide/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/slide", - "version": "2.1.3", + "version": "2.1.4", "description": "a carousel effect triggered by BetterScroll", "author": { "name": "jizhi", @@ -30,7 +30,7 @@ "directory": "packages/slide" }, "dependencies": { - "@better-scroll/core": "^2.1.3" + "@better-scroll/core": "^2.1.4" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/vuepress-docs/package.json b/packages/vuepress-docs/package.json index 498d351e..40e84e54 100644 --- a/packages/vuepress-docs/package.json +++ b/packages/vuepress-docs/package.json @@ -1,6 +1,6 @@ { "name": "vuepress-docs", - "version": "2.1.3", + "version": "2.1.4", "description": "Docs of BetterScroll", "author": { "name": "huangyi", diff --git a/packages/wheel/package.json b/packages/wheel/package.json index a215f913..2dc45fb5 100644 --- a/packages/wheel/package.json +++ b/packages/wheel/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/wheel", - "version": "2.1.3", + "version": "2.1.4", "description": "a BetterScroll plugin to imitate IOS Picker", "author": { "name": "jizhi", @@ -29,7 +29,7 @@ "url": "git@github.com:ustbhuangyi/better-scroll.git" }, "dependencies": { - "@better-scroll/core": "^2.1.3" + "@better-scroll/core": "^2.1.4" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } diff --git a/packages/zoom/package.json b/packages/zoom/package.json index ec1d15a6..52e8acbf 100644 --- a/packages/zoom/package.json +++ b/packages/zoom/package.json @@ -1,6 +1,6 @@ { "name": "@better-scroll/zoom", - "version": "2.1.3", + "version": "2.1.4", "description": "a BetterScroll plugin to enlarge or narrow", "author": { "name": "jizhi", @@ -32,7 +32,7 @@ "directory": "packages/zoom" }, "dependencies": { - "@better-scroll/core": "^2.1.3" + "@better-scroll/core": "^2.1.4" }, "gitHead": "f441227b6137d44ba0b44b97ed4cd49de9386130" } From 1386588c12059c014a8cf3941223b945e74f632e Mon Sep 17 00:00:00 2001 From: wjq990112 <1163585385@qq.com> Date: Mon, 25 Jan 2021 23:56:19 +0800 Subject: [PATCH 21/25] fix(pull-up): fix "pullingUp" event execution time fix #1149 --- packages/pull-up/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pull-up/src/index.ts b/packages/pull-up/src/index.ts index 944110a8..1396264d 100644 --- a/packages/pull-up/src/index.ts +++ b/packages/pull-up/src/index.ts @@ -119,7 +119,7 @@ export default class PullUp implements PluginAPI { if ( this.scroll.movingDirectionY === Direction.Positive && - pos.y <= this.scroll.maxScrollY + threshold + pos.y <= this.scroll.maxScrollY - threshold ) { this.pulling = true // must reset pulling after scrollEnd From e3a0252e4b67761d40a37f8ebc0426fe833a3350 Mon Sep 17 00:00:00 2001 From: wjq990112 <1163585385@qq.com> Date: Tue, 26 Jan 2021 12:26:23 +0800 Subject: [PATCH 22/25] docs(pullup): fix the default value of "threshold" fix #1149 --- packages/vuepress-docs/docs/en-US/plugins/pullup.md | 4 ++-- packages/vuepress-docs/docs/zh-CN/plugins/pullup.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/vuepress-docs/docs/en-US/plugins/pullup.md b/packages/vuepress-docs/docs/en-US/plugins/pullup.md index 829f16b2..f4fbb1b3 100644 --- a/packages/vuepress-docs/docs/en-US/plugins/pullup.md +++ b/packages/vuepress-docs/docs/en-US/plugins/pullup.md @@ -69,7 +69,7 @@ const bs = new BScroll('.wrapper', { const bs = new BScroll('.wrapper', { pullUpLoad: { - threshold: 90 + threshold: 0 } }) ``` @@ -141,4 +141,4 @@ bs.closePullUp() ::: danger Note After the pullUpLoad action is detected, the consumption opportunity of the `pullingUp` event is only once, so you need to call `finishPullUp()` to tell BetterScroll to provide the next consumption opportunity of the `pullingUp` event. -::: \ No newline at end of file +::: diff --git a/packages/vuepress-docs/docs/zh-CN/plugins/pullup.md b/packages/vuepress-docs/docs/zh-CN/plugins/pullup.md index 22698247..2ffd0b43 100644 --- a/packages/vuepress-docs/docs/zh-CN/plugins/pullup.md +++ b/packages/vuepress-docs/docs/zh-CN/plugins/pullup.md @@ -52,7 +52,7 @@ yarn add @better-scroll/pull-up ### threshold - **类型:** `number` - - **默认值:** `90` + - **默认值:** `0` 触发上拉事件的阈值。 @@ -68,7 +68,7 @@ const bs = new BScroll('.wrapper', { const bs = new BScroll('.wrapper', { pullUpLoad: { - threshold: 90 + threshold: 0 } }) ``` @@ -138,4 +138,4 @@ bs.closePullUp() ::: danger 警告 监测到上拉刷新的动作之后,`pullingUp` 事件的消费机会只有一次,因此你需要调用 `finishPullUp()` 来告诉 BetterScroll 来提供下一次 `pullingUp` 事件的消费机会。 - ::: \ No newline at end of file + ::: From 6924d827407d4361df33a498dabd0cc30d979cb1 Mon Sep 17 00:00:00 2001 From: theniceangel Date: Tue, 26 Jan 2021 14:56:48 +0800 Subject: [PATCH 23/25] fix(pullup): fix typo --- packages/vuepress-docs/docs/zh-CN/plugins/pullup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vuepress-docs/docs/zh-CN/plugins/pullup.md b/packages/vuepress-docs/docs/zh-CN/plugins/pullup.md index 22698247..7d62fc7f 100644 --- a/packages/vuepress-docs/docs/zh-CN/plugins/pullup.md +++ b/packages/vuepress-docs/docs/zh-CN/plugins/pullup.md @@ -52,7 +52,7 @@ yarn add @better-scroll/pull-up ### threshold - **类型:** `number` - - **默认值:** `90` + - **默认值:** `0` 触发上拉事件的阈值。 From a95abe1d9fbc572a91f8dd4060e8c76fd1c1185e Mon Sep 17 00:00:00 2001 From: theniceangel Date: Tue, 26 Jan 2021 15:07:36 +0800 Subject: [PATCH 24/25] chore: handle pr --- packages/pull-up/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pull-up/src/index.ts b/packages/pull-up/src/index.ts index 1396264d..944110a8 100644 --- a/packages/pull-up/src/index.ts +++ b/packages/pull-up/src/index.ts @@ -119,7 +119,7 @@ export default class PullUp implements PluginAPI { if ( this.scroll.movingDirectionY === Direction.Positive && - pos.y <= this.scroll.maxScrollY - threshold + pos.y <= this.scroll.maxScrollY + threshold ) { this.pulling = true // must reset pulling after scrollEnd From 74f5178475659f8727939d385baed283fb42dd3c Mon Sep 17 00:00:00 2001 From: theniceangel Date: Tue, 26 Jan 2021 15:29:50 +0800 Subject: [PATCH 25/25] docs(pullup): optimize doc --- packages/vuepress-docs/docs/en-US/plugins/pullup.md | 7 ++++--- packages/vuepress-docs/docs/zh-CN/plugins/pullup.md | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/vuepress-docs/docs/en-US/plugins/pullup.md b/packages/vuepress-docs/docs/en-US/plugins/pullup.md index f4fbb1b3..dd02cd94 100644 --- a/packages/vuepress-docs/docs/en-US/plugins/pullup.md +++ b/packages/vuepress-docs/docs/en-US/plugins/pullup.md @@ -116,7 +116,6 @@ bs.closePullUp() export interface PullUpLoadConfig { threshold: number - stop: number } ``` @@ -136,8 +135,10 @@ bs.closePullUp() ### `pullingUp` -- **Arguments**: None -- **Trigger**: When the distance to the bottom is less than the value of `threshold`, a `pullingUp` event is triggered. + - **Arguments**: None + - **Trigger**: When the distance to the bottom is less than the value of `threshold`, a `pullingUp` event is triggered. + + > When threshold is a positive number, it means `pullingUp` is triggered when the threshold pixel is away from the scroll boundary. On the contrary, it means that the event will be triggered when it crosses the scroll boundary. ::: danger Note After the pullUpLoad action is detected, the consumption opportunity of the `pullingUp` event is only once, so you need to call `finishPullUp()` to tell BetterScroll to provide the next consumption opportunity of the `pullingUp` event. diff --git a/packages/vuepress-docs/docs/zh-CN/plugins/pullup.md b/packages/vuepress-docs/docs/zh-CN/plugins/pullup.md index 2ffd0b43..20224065 100644 --- a/packages/vuepress-docs/docs/zh-CN/plugins/pullup.md +++ b/packages/vuepress-docs/docs/zh-CN/plugins/pullup.md @@ -56,6 +56,7 @@ yarn add @better-scroll/pull-up 触发上拉事件的阈值。 + :::tip 提示 当 pullUpLoad 配置为 true 的时候,插件内部使用的是默认的插件选项对象。 @@ -136,6 +137,8 @@ bs.closePullUp() - **参数**:无 - **触发时机**:当距离滚动到底部小于 `threshold` 值时,触发一次 `pullingUp` 事件。 + > 当 threshold 为正数,代表距离滚动边界 threshold 像素的时候触发 `pullingUp`,反之,代表越过滚动边界才会触发事件 + ::: danger 警告 监测到上拉刷新的动作之后,`pullingUp` 事件的消费机会只有一次,因此你需要调用 `finishPullUp()` 来告诉 BetterScroll 来提供下一次 `pullingUp` 事件的消费机会。 :::