-
Notifications
You must be signed in to change notification settings - Fork 9
Conversation
1. set preview `:initial-index` to `0` if src is not in previewSrcList ElemeFE#18871 and also fix preview example 2. fix ESC won't close preview for the second time ElemeFE#19027 ElemeFE#18906 3. fix undesired `overflow: scroll` style ElemeFE#18967 4. fix a race condition if src changes too frequently ElemeFE#18837 5. add `close-on-click-modal` prop ElemeFE#18947
@@ -216,7 +202,7 @@ export default { | |||
}, | |||
handleImgError(e) { | |||
this.loading = false; | |||
e.target.alt = '加载失败'; | |||
e.target.alt = this.t('el.image.error'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.t ??
this.loading = true; | ||
} | ||
}); | ||
} | ||
}, | ||
methods: { | ||
hide() { | ||
this.deviceSupportUninstall(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个方法在 destroyed 调用了,整个组件是用 v-if 管理的
见 https://github.com/EOITek/element/pull/18/files#diff-4070c65e02876a1516baf9e0f17ebc22R18
@@ -216,7 +202,7 @@ export default { | |||
}, | |||
handleImgError(e) { | |||
this.loading = false; | |||
e.target.alt = '加载失败'; | |||
e.target.alt = this.t('el.image.error'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.t 是element做国际化使用的方法,会按照名字查找对应的翻译
await wait(1000); | ||
expect($wrapper.style.display).to.equal('none'); | ||
await wait(600); | ||
expect(vm.$el.querySelector('.el-image-viewer__wrapper')).to.be.null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.to.be.null; 这是什么操作 没看懂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to.be.null 就是 === null,这是单元测试的语法
await wait(1000); | ||
expect($wrapper.style.display).to.equal('none'); | ||
await wait(600); | ||
expect(vm.$el.querySelector('.el-image-viewer__wrapper')).to.be.null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为v-if掉了所以就是null了
:initial-index
to0
if src is not in previewSrcListfix: The first list is displayed by default when there is no
src
in thepreviewSrcList
ElemeFE/element#18871and also fix preview example
如果
previewSrcList
里没有当前显示的图片url,默认预览第一张图片(example里的情况)修复第二次打开预览界面后ESC无效bug
Image: fix Esc can never close the preview at the second time #1… ElemeFE/element#19027
[Image]: Fix page cannot scroll up and down when previewSrcList is empty ElemeFE/element#18906
overflow: scroll
style修复点击没有预览功能的图片后body上加了
overflow: scroll
的bugImage: don't show image-viewer when preview is false ElemeFE/element#18967
修复如果用户点击过快事件触发混乱的bug
Image: fix a race condition if src changes too frequently ElemeFE/element#18837
close-on-click-modal
prop添加点击遮罩层关闭预览的功能
image: 增加 close-on-click-modal props 控制点击mask 关闭预览图的功能 ElemeFE/element#18947
Please make sure these boxes are checked before submitting your PR, thank you!
dev
branch.