Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 93846c9

Browse files
authored
update upload panel img prop
avoid issues when $pattern is not correctly set in the view
1 parent 4d2be1a commit 93846c9

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/resources/assets/js/modules/computed.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,12 @@ export default {
7777
let imgs = this.uploadPanelImgList
7878
let grds = this.uploadPanelGradients
7979

80-
let url = imgs[Math.floor(Math.random() * imgs.length)]
80+
let url = imgs.length ? imgs[Math.floor(Math.random() * imgs.length)] : null
8181
let color = grds[Math.floor(Math.random() * grds.length)]
82-
83-
return {
84-
'--gradient': color,
85-
'background-image': `url("${url}")`
86-
}
82+
83+
return url
84+
? {'--gradient': color, 'background-image': `url("${url}")`}
85+
: {'--gradient': color}
8786
}
8887
},
8988

0 commit comments

Comments
 (0)