Merge pull request #9844 from dataease/pr@dev@fix_picture-url

fix(仪表板): 修复图片组件不能相对路径访问的问题
This commit is contained in:
王嘉豪 2024-05-24 15:05:19 +08:00 committed by GitHub
commit c8a67f4699
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -3,7 +3,7 @@
<img
v-if="!showLink"
:style="imageAdapter"
:src="element.propValue"
:src="imgUrlTrans(element.propValue)"
>
<a
v-if="showLink"
@ -13,14 +13,17 @@
>
<img
:style="imageAdapter"
:src="element.propValue"
:src="imgUrlTrans(element.propValue)"
>
</a>
</div>
</template>
<script>
import {imgUrlTrans} from "@/components/canvas/utils/utils";
export default {
methods: {imgUrlTrans},
props: {
element: {
type: Object,

View File

@ -299,7 +299,8 @@ export function colorReverse(OldColorValue) {
}
export function imgUrlTrans(url) {
if (url && typeof url === 'string' && url.indexOf('static-resource') > -1) {
console.log('---'+url +'---'+ process.env.VUE_APP_BASE_API)
if (url && typeof url === 'string' && url.indexOf('static-resource') > -1 && url.indexOf('http') === -1) {
return process.env.VUE_APP_BASE_API + url.replace('/static-resource', 'static-resource')
} else {
return url