Showing
2 changed files
with
8 additions
and
12 deletions
| ... | ... | @@ -90,12 +90,10 @@ const selectValue = ref('') |
| 90 | 90 | //TODO待封装 成传文件夹名字获取下面所有图片 |
| 91 | 91 | const getFetchImages = () => { |
| 92 | 92 | const imagesModules = import.meta.globEager('@/assets/external/headbackground/*') |
| 93 | - for (const key in imagesModules) { | |
| 94 | - selectBgOptions.value.push({ | |
| 95 | - label: imagesModules[key]?.default.slice(25), | |
| 96 | - value: imagesModules[key]?.default | |
| 97 | - }) | |
| 98 | - } | |
| 93 | + selectBgOptions.value = Object.keys(imagesModules).map(item => ({ | |
| 94 | + label: imagesModules[item]?.default.split('/').at(-1), | |
| 95 | + value: imagesModules[item]?.default | |
| 96 | + })) | |
| 99 | 97 | } |
| 100 | 98 | getFetchImages() |
| 101 | 99 | ... | ... |
| ... | ... | @@ -168,12 +168,10 @@ const selectBgOptions = ref<Array<SelectOption>>([]) |
| 168 | 168 | //TODO待封装 成传文件夹名字获取下面所有图片 |
| 169 | 169 | const getFetchImages = () => { |
| 170 | 170 | const imagesModules = import.meta.globEager('@/assets/external/background/*') |
| 171 | - for (const key in imagesModules) { | |
| 172 | - selectBgOptions.value.push({ | |
| 173 | - label: imagesModules[key]?.default.slice(25), | |
| 174 | - value: imagesModules[key]?.default | |
| 175 | - }) | |
| 176 | - } | |
| 171 | + selectBgOptions.value = Object.keys(imagesModules).map(item => ({ | |
| 172 | + label: imagesModules[item]?.default.split('/').at(-1), | |
| 173 | + value: imagesModules[item]?.default | |
| 174 | + })) | |
| 177 | 175 | } |
| 178 | 176 | getFetchImages() |
| 179 | 177 | ... | ... |