在我的应用程序中,管理员可以为每个用户输入评分。我使用 raty js 来显示和输入星级..
事情是我可以通过这个得到一个整数值。我试图通过这个设置浮点值,比如半星和所有 这就是我所做的..但输出仍然是全星..不是半星..
$('#expert_star').raty({
<% expert_score = (@expert_rating && @expert_rating.score.present?) ? @expert_rating.score : 0 %>
showHalf: true,
score: <%= expert_score %>,
readOnly: <%= expert_score > 0 ? true : false %>,
mouseover: function(score) {
console.log("Score: "+score);
}
});
忽略 jquery 脚本中的 ruby 代码
最佳答案
请添加 half: true 并尝试。
关于javascript - Raty Js 星级评分以提供浮点值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25301085/