fix(Calendar): should not emit scale event when scale not changed (#7975)

* fix(Calendar): should not emit scale event when scale not changed

* chore: update
This commit is contained in:
neverland 2021-01-23 16:28:36 +08:00 committed by GitHub
parent 598fd4a464
commit 93298ec3b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View File

@ -94,11 +94,15 @@ export default {
}); });
const setScale = (scale) => { const setScale = (scale) => {
state.scale = range(scale, +props.minZoom, +props.maxZoom); scale = range(scale, +props.minZoom, +props.maxZoom);
emit('scale', {
scale: state.scale, if (scale !== state.scale) {
index: props.active, state.scale = scale;
}); emit('scale', {
scale,
index: props.active,
});
}
}; };
const resetScale = () => { const resetScale = () => {

View File

@ -127,7 +127,7 @@ export default {
| showIndex | Whether to show index | _boolean_ | `true` | | showIndex | Whether to show index | _boolean_ | `true` |
| showIndicators | Whether to show indicators | _boolean_ | `false` | | showIndicators | Whether to show indicators | _boolean_ | `false` |
| loop | Whether to enable loop | _boolean_ | `true` | | loop | Whether to enable loop | _boolean_ | `true` |
| swipeDuration | Animation duration (ms) | _number \| string_ | `500` | | swipeDuration | Animation duration (ms) | _number \| string_ | `300` |
| onClose | Emitted when ImagePreview is closed | _Function_ | - | | onClose | Emitted when ImagePreview is closed | _Function_ | - |
| onChange | Emitted when current image changed | _Function_ | - | | onChange | Emitted when current image changed | _Function_ | - |
| onScale | Emitted when scaling current image | _Function_ | - | | onScale | Emitted when scaling current image | _Function_ | - |

View File

@ -186,7 +186,7 @@ export default {
| --- | --- | --- | --- | | --- | --- | --- | --- |
| images | 需要预览的图片 URL 数组 | _string[]_ | `[]` | | images | 需要预览的图片 URL 数组 | _string[]_ | `[]` |
| start-position | 图片预览起始位置索引 | _number \| string_ | `0` | | start-position | 图片预览起始位置索引 | _number \| string_ | `0` |
| swipe-duration | 动画时长,单位为 ms | _number \| string_ | `500` | | swipe-duration | 动画时长,单位为 ms | _number \| string_ | `300` |
| show-index | 是否显示页码 | _boolean_ | `true` | | show-index | 是否显示页码 | _boolean_ | `true` |
| show-indicators | 是否显示轮播指示器 | _boolean_ | `false` | | show-indicators | 是否显示轮播指示器 | _boolean_ | `false` |
| loop | 是否开启循环播放 | _boolean_ | `true` | | loop | 是否开启循环播放 | _boolean_ | `true` |