TASK: #111576 列slider cover 属性支持小数
This commit is contained in:
parent
500951aa8e
commit
69958f7db8
|
@ -14,8 +14,10 @@
|
|||
```
|
||||
|
||||
2. `cover` --- 初始填充<br>
|
||||
`cover="50"` 和 `cover="50%"`都表示初始填充音量条的50%<br>
|
||||
`cover="150px"` 表示准确的填充长度<br>
|
||||
`cover="50"` 和 `cover="50%"` 都表示初始填充音量条的50%<br>
|
||||
`cover="78.2"` 和 `cover="78.2%"` 都表示初始填充音量条的78.2%<br>
|
||||
`cover="150px"` 和 `cover="113.5px"` 表示准确的填充长度<br>
|
||||
|
||||
|
||||
```
|
||||
<star-slider cover="150px"></star-slider>
|
||||
|
|
|
@ -3,9 +3,9 @@ import {customElement, property, query} from 'lit/decorators.js'
|
|||
import {sharedStyles} from './slider-styles.js'
|
||||
|
||||
function getType(str: string) {
|
||||
if (/^\d*px$/.test(str)) {
|
||||
if (/^\d*(\.\d*)?px$/.test(str)) {
|
||||
return 'static'
|
||||
} else if (/^\d*%?$/.test(str)) {
|
||||
} else if (/^\d*(\.\d*)?%?$/.test(str)) {
|
||||
return 'percent'
|
||||
} else {
|
||||
return 'invalid'
|
||||
|
|
Loading…
Reference in New Issue