react根据数值显示星级评分效果代码
代码语言:html
所属分类:星级评分
代码描述:react根据数值显示星级评分效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/all.min.css"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/bootstrap.4.3.1.min.css"> <style> body { background-color: #1c1e22; display: grid; grid-template-rows: 1; justify-content: center; } .rating { margin: 12px; } .rating i { font-size: 36px; color: #FFDF00; } .card { min-width: 300px; margin-right: 16px; margin-top: 36px; padding: 36px; border-radius: 12px; box-shadow: 10px 10px 1px 1px rgba(225, 225, 225, 0.3); } </style> </head> <body> <div id="root"></div> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/babel.min.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/react.production.16.13.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/react-dom.production.16.13.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/prop-types.min.js"></script> <script type="text/babel" > class Rating extends React.Component { constructor(props){ super(props) } stars = () => { let breakPoint = -1 const remainder = this.props.score % 1 if(remainder){ breakPoint = Math.floor(this.props.score) + 1 } let s = new Array() for(let i = 1; i <= this.props.maxScore; i++).........完整代码请登录后点击上方下载按钮下载查看
网友评论0