Skip to content

Commit

Permalink
fix: 修复 slider 在 appx 1.0 报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamondYuan committed Dec 4, 2023
1 parent f4b5d58 commit 833e7f2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
5 changes: 4 additions & 1 deletion compiled/alipay/src/Slider/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,11 @@ export class SliderController {

private async getRect(component: any, e: any): Promise<any> {
const elementId = e.currentTarget.id;

let instance = component;
instance = my;
const element = await getInstanceBoundingClientRect(
component,
instance,
`#${elementId}`
);
const touch = e.changedTouches[0];
Expand Down
5 changes: 3 additions & 2 deletions compiled/wechat/src/Slider/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
7 changes: 6 additions & 1 deletion src/Slider/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,13 @@ export class SliderController {

private async getRect(component: any, e: any): Promise<any> {
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];
Expand Down
1 change: 0 additions & 1 deletion tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ function createInstance(config: Instance, props: Record<string, any>, my: any) {
methods: {
...config.methods,
},
createSelectorQuery: my.createSelectorQuery,
setData(data: Record<string, any>, callback: (this: Instance) => void) {
if (shallowequal(data, instance.data)) {
return;
Expand Down

0 comments on commit 833e7f2

Please sign in to comment.