From 833e7f2afb6a4364806fc1521c24b42b3392ff55 Mon Sep 17 00:00:00 2001 From: DiamondYuan Date: Mon, 4 Dec 2023 16:06:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20slider=20=E5=9C=A8?= =?UTF-8?q?=20appx=201.0=20=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compiled/alipay/src/Slider/controller.ts | 5 ++++- compiled/wechat/src/Slider/controller.js | 5 +++-- src/Slider/controller.ts | 7 ++++++- tests/utils.ts | 1 - 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/compiled/alipay/src/Slider/controller.ts b/compiled/alipay/src/Slider/controller.ts index eca3aaec9..732157f22 100644 --- a/compiled/alipay/src/Slider/controller.ts +++ b/compiled/alipay/src/Slider/controller.ts @@ -119,8 +119,11 @@ export class SliderController { private async getRect(component: any, e: any): Promise { const elementId = e.currentTarget.id; + + let instance = component; + instance = my; const element = await getInstanceBoundingClientRect( - component, + instance, `#${elementId}` ); const touch = e.changedTouches[0]; diff --git a/compiled/wechat/src/Slider/controller.js b/compiled/wechat/src/Slider/controller.js index 4642bbecd..7aad12c57 100644 --- a/compiled/wechat/src/Slider/controller.js +++ b/compiled/wechat/src/Slider/controller.js @@ -126,12 +126,13 @@ var SliderController = /** @class */ (function () { }; SliderController.prototype.getRect = function (component, e) { return __awaiter(this, void 0, void 0, function () { - var elementId, element, touch; + var elementId, instance, element, touch; return __generator(this, function (_a) { switch (_a.label) { case 0: elementId = e.currentTarget.id; - return [4 /*yield*/, getInstanceBoundingClientRect(component, "#".concat(elementId))]; + instance = component; + return [4 /*yield*/, getInstanceBoundingClientRect(instance, "#".concat(elementId))]; case 1: element = _a.sent(); touch = e.changedTouches[0]; diff --git a/src/Slider/controller.ts b/src/Slider/controller.ts index eca3aaec9..2387dbe2a 100644 --- a/src/Slider/controller.ts +++ b/src/Slider/controller.ts @@ -119,8 +119,13 @@ export class SliderController { private async getRect(component: any, e: any): Promise { const elementId = e.currentTarget.id; + + let instance = component; + /// #if ALIPAY + instance = my; + /// #endif const element = await getInstanceBoundingClientRect( - component, + instance, `#${elementId}` ); const touch = e.changedTouches[0]; diff --git a/tests/utils.ts b/tests/utils.ts index 7c86837a5..afc463240 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -66,7 +66,6 @@ function createInstance(config: Instance, props: Record, my: any) { methods: { ...config.methods, }, - createSelectorQuery: my.createSelectorQuery, setData(data: Record, callback: (this: Instance) => void) { if (shallowequal(data, instance.data)) { return;