chuanFE

最简易的评分组件

1
2
var rate = 1
"★★★★★☆☆☆☆☆".slice(5 - rate, 10 - rate)

结果:”★☆☆☆☆”

1
2
var rate = 2
"★★★★★☆☆☆☆☆".slice(5 - rate, 10 - rate)

结果:”★★☆☆☆”

1
2
var rate = 3
"★★★★★☆☆☆☆☆".slice(5 - rate, 10 - rate)

结果:”★★★☆☆”

1
2
var rate = 4
"★★★★★☆☆☆☆☆".slice(5 - rate, 10 - rate)

结果:”★★★★☆”

1
2
var rate = 5
"★★★★★☆☆☆☆☆".slice(5 - rate, 10 - rate)

结果:”★★★★★”

我知道是不会有人点的,但万一有人想不开呢?