Skip to content

Commit 833e7f2

Browse files
author
DiamondYuan
committed
fix: 修复 slider 在 appx 1.0 报错的问题
1 parent f4b5d58 commit 833e7f2

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

compiled/alipay/src/Slider/controller.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,11 @@ export class SliderController {
119119

120120
private async getRect(component: any, e: any): Promise<any> {
121121
const elementId = e.currentTarget.id;
122+
123+
let instance = component;
124+
instance = my;
122125
const element = await getInstanceBoundingClientRect(
123-
component,
126+
instance,
124127
`#${elementId}`
125128
);
126129
const touch = e.changedTouches[0];

compiled/wechat/src/Slider/controller.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,13 @@ var SliderController = /** @class */ (function () {
126126
};
127127
SliderController.prototype.getRect = function (component, e) {
128128
return __awaiter(this, void 0, void 0, function () {
129-
var elementId, element, touch;
129+
var elementId, instance, element, touch;
130130
return __generator(this, function (_a) {
131131
switch (_a.label) {
132132
case 0:
133133
elementId = e.currentTarget.id;
134-
return [4 /*yield*/, getInstanceBoundingClientRect(component, "#".concat(elementId))];
134+
instance = component;
135+
return [4 /*yield*/, getInstanceBoundingClientRect(instance, "#".concat(elementId))];
135136
case 1:
136137
element = _a.sent();
137138
touch = e.changedTouches[0];

src/Slider/controller.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,13 @@ export class SliderController {
119119

120120
private async getRect(component: any, e: any): Promise<any> {
121121
const elementId = e.currentTarget.id;
122+
123+
let instance = component;
124+
/// #if ALIPAY
125+
instance = my;
126+
/// #endif
122127
const element = await getInstanceBoundingClientRect(
123-
component,
128+
instance,
124129
`#${elementId}`
125130
);
126131
const touch = e.changedTouches[0];

tests/utils.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ function createInstance(config: Instance, props: Record<string, any>, my: any) {
6666
methods: {
6767
...config.methods,
6868
},
69-
createSelectorQuery: my.createSelectorQuery,
7069
setData(data: Record<string, any>, callback: (this: Instance) => void) {
7170
if (shallowequal(data, instance.data)) {
7271
return;

0 commit comments

Comments
 (0)