forgeplus-react/src/forge/Information/Component/defaultImg.jsx

22 lines
649 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from 'react';
function DefaultImg({name,title}){
function randomNumberInRange(min, max) {
// ? 获取 min和 max之间的数字
return Math.floor(Math.random() * (max - min + 1)) + min;
}
return(
<div className="defaultBox">
<img src={require(`../img/back${randomNumberInRange(1,3)}.png`).default} alt="" className="back" />
<img src={require(`../img/color${randomNumberInRange(1,4)}.png`).default} alt="" className="color" />
<span className="d_name">
<span>{name}</span>
{/* <span>{title}</span> */}
</span>
</div>
)
}
export default DefaultImg;