47 lines
1.7 KiB
JavaScript
47 lines
1.7 KiB
JavaScript
![]() |
import { __assign, __rest } from "tslib";
|
||
|
import { platform } from '../_util/platform';
|
||
|
export function transformOptions(original) {
|
||
|
if (platform() === 'wechat') {
|
||
|
var props = original.props, didMount_1 = original.didMount, didUpdate = original.didUpdate, rest = __rest(original, ["props", "didMount", "didUpdate"]);
|
||
|
return __assign(__assign({}, rest), { properties: transformProperties(props), lifetimes: {
|
||
|
attached: function () {
|
||
|
return didMount_1.call(this);
|
||
|
},
|
||
|
}, options: {
|
||
|
multipleSlots: true,
|
||
|
styleIsolation: 'shared',
|
||
|
}, observers: {
|
||
|
'damping, swiped': function () {
|
||
|
this.setData({
|
||
|
swipeX: 0,
|
||
|
swipedR: false,
|
||
|
swipedL: false,
|
||
|
tapTypeL: '',
|
||
|
tapTypeR: '',
|
||
|
});
|
||
|
},
|
||
|
'elasticity': function (elasticity) {
|
||
|
this.setData({
|
||
|
swipeX: 0,
|
||
|
swipedR: false,
|
||
|
swipedL: false,
|
||
|
tapTypeL: '',
|
||
|
tapTypeR: '',
|
||
|
});
|
||
|
this.setData({ inertiaWidth: elasticity ? 20 : 0 });
|
||
|
},
|
||
|
} });
|
||
|
}
|
||
|
return __assign({}, original);
|
||
|
}
|
||
|
export function transformProperties(props) {
|
||
|
var properties = {};
|
||
|
Object.keys(props).forEach(function (key) {
|
||
|
properties[key] = {
|
||
|
type: null,
|
||
|
value: props[key],
|
||
|
};
|
||
|
});
|
||
|
return properties;
|
||
|
}
|