ElemeFE / ElemeFE/element

[Bug Report] el-image doesn't respect publicPath

Open
#21,596 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Vue
Stars
54k
Forks
14.4k
PR merge metrics
No merged PRs in 30d

Description

### Element UI version
2.13.2

### OS/Browsers version
Windows 10 / Chrome 96.0.4664.110 (Official Build) (64-bit)

### Vue version
2.6.12

### Reproduction Link
https://codepen.io/ashishgehlot95/pen/ZEXrjBQ?editors=1000

### Steps to reproduce
Steps:
1. Add publicPath in vue.config.js
publicPath: process.env.NODE_ENV === "production" ? "/JSP/new_solution_designer/" : "/JSP/"

2. update router with following value:
base: process.env.BASE_URL,

3. Create a component and add following el-image element

### What is Expected?
el-image should load image like native img tag loads.

### What is actually happening?
el-image is loading image from root path instead of base_url / public_path configured.
image path should be translated as below
www.domain.com/sub1/sub2//assets/img/display-name-2-32x32.png
instead of
www.domain.com/assets/img/display-name-2-32x32.png

It is working fine with native img tag. Browser automatically maps path with relative path.
www.domain.com/sub1/sub2//assets/img/display-name-2-32x32.png

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.