feat: 更新随机图片选择逻辑,支持随机选择2或3
This commit is contained in:
BIN
src/pages/Page/vite-assets/imgs/img_3.png
Normal file
BIN
src/pages/Page/vite-assets/imgs/img_3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 MiB |
@ -8,12 +8,12 @@ function getImageUrl(name: string) {
|
||||
|
||||
const img_modules = import.meta.glob<{ default: string }>('./imgs/*.png', { eager: true });
|
||||
|
||||
function getRandom1or2() {
|
||||
return Math.random() < 0.5 ? '1' : '2';
|
||||
function getRandom2or3() {
|
||||
return Math.random() < 0.5 ? '2' : '3';
|
||||
}
|
||||
|
||||
function getRandomImage() {
|
||||
return getImageUrl(getRandom1or2());
|
||||
return getImageUrl(getRandom2or3());
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Reference in New Issue
Block a user