ElemeFE / ElemeFE/element

[bug report] the picture preview function is optimized and appendtobody is supported. As a result, the private style v-deep cannot work normally on the image viewer, a large picture preview component of El image

Open
#20,852 2 comments 0 reactions 0 assignees View on GitHub
component: image stale
Dominant language
Vue
Stars
54k
Forks
14.4k
PR merge metrics
No merged PRs in 30d

Description

![000](https://user-images.githubusercontent.com/37680011/111488074-dfc2b380-8773-11eb-923a-d40b8674ceaa.png)
![111](https://user-images.githubusercontent.com/37680011/111486639-9e7dd400-8772-11eb-9ccc-859572fd7c3a.png)
![222](https://user-images.githubusercontent.com/37680011/111486656-a178c480-8772-11eb-8113-3048a6f5a4e4.png)

### Element UI version
2.15.0

### OS/Browsers version
windows10

### Vue version
2.6.12

### Reproduction Link
https://codepen.io/dfaglory/pen/abBrWMa

### Steps to reproduce
注意:复现链接:https://codepen.io/dfaglory/pen/abBrWMa 并没有复现bug,因为codepen无法设置vue文件的私有样式,该链接实际上是我希望生成的效果。

在2.15.0版bug修复#20652 https://github.com/ElemeFE/element/pull/20652
图片预览功能优化,第一条:支持 appendToBody。
优化内容为:<el-image>的大图预览功能,添加了一个属性appendToBody,该属性向body中添加了this.$el,问题源码位置:https://github.com/ElemeFE/element/blob/master/packages/image/src/image-viewer.vue 310行至312行,问题源码如下:

```
310 if (this.appendToBody) {
311 document.body.appendChild(this.$el);
312 }
```

该源码导致.vue文件如果使用私有样式scoped进行深度穿透::v-deep,无法正常生成私有样式。

我想修改大图预览右上角的关闭图标<i class="el-icon-close"></i>的颜色为红色,例子如下:
```
<style scoped>
::v-deep .el-icon-close {
color: red;
}

```

该样式不生效

### What is Expected?
的大图预览的右上角图标关闭图标变成红色

### What is actually happening?
图标样式不生效

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.