简化赋值
parent
24095297a5
commit
e691868a55
|
@ -161,10 +161,9 @@ class Progress extends Component {
|
|||
return Math.max(0, Math.min(val, 100))
|
||||
}
|
||||
|
||||
#drawCircle() {
|
||||
#drawCircle(v) {
|
||||
let offset = OFFSET[this.type]
|
||||
let dash = DASH_ARRAY[this.type]
|
||||
let v = this.value
|
||||
return html`
|
||||
<svg viewBox="0 0 128 128">
|
||||
<path
|
||||
|
@ -185,8 +184,7 @@ class Progress extends Component {
|
|||
`
|
||||
}
|
||||
|
||||
#drawLine() {
|
||||
let v = this.value
|
||||
#drawLine(v) {
|
||||
return html`
|
||||
<div class="progress-bar">
|
||||
<mark class="thumb" style=${styleMap({ width: v + '%' })}></mark>
|
||||
|
@ -198,10 +196,11 @@ class Progress extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let step = ~~(this.value / 20) || 1
|
||||
let v = this.value
|
||||
let step = ~~(v / 20) || 1
|
||||
return html`
|
||||
<main class="container" step=${step}>
|
||||
${this.type === TYPE_LINE ? this.#drawLine() : this.#drawCircle()}
|
||||
${this.type === TYPE_LINE ? this.#drawLine(v) : this.#drawCircle(v)}
|
||||
</main>
|
||||
`
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue