diff --git a/packages/notify/notify.ts b/packages/notify/notify.ts index dc13906a..47f854aa 100644 --- a/packages/notify/notify.ts +++ b/packages/notify/notify.ts @@ -39,7 +39,7 @@ function getContext() { } export default function Notify(options: NotifyOptions | string) { - options = Object.assign({}, defaultOptions, parseOptions(options)); + options = { ...defaultOptions, ...parseOptions(options) } as NotifyOptions; const context = options.context || getContext(); const notify = context.selectComponent(options.selector); @@ -57,7 +57,7 @@ export default function Notify(options: NotifyOptions | string) { } Notify.clear = function(options?: NotifyOptions) { - options = Object.assign({}, defaultOptions, parseOptions(options)); + options = { ...defaultOptions, ...parseOptions(options) } as NotifyOptions; const context = options.context || getContext(); const notify = context.selectComponent(options.selector); diff --git a/packages/slider/index.ts b/packages/slider/index.ts index ff187696..56917b83 100644 --- a/packages/slider/index.ts +++ b/packages/slider/index.ts @@ -60,7 +60,7 @@ VantComponent({ this.dragStatus = 'draging'; this.getRect('.van-slider').then((rect: WechatMiniprogram.BoundingClientRectCallbackResult) => { - const diff = this.deltaX / rect.width * 100; + const diff = (this.deltaX / rect.width) * 100; this.newValue = this.startValue + diff; this.updateValue(this.newValue, false, true); }); @@ -81,7 +81,7 @@ VantComponent({ const { min } = this.data; this.getRect('.van-slider').then((rect: WechatMiniprogram.BoundingClientRectCallbackResult) => { - const value = (event.detail.x - rect.left) / rect.width * this.getRange() + min; + const value = ((event.detail.x - rect.left) / rect.width) * this.getRange() + min; this.updateValue(value, true); }); },