Skip to content

Commit

Permalink
fix(runtime-web): slider 展示的值与预设值不匹配 (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
hwaphon authored Dec 12, 2023
1 parent 3d2fe8a commit ec0cd19
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/runtime-web/src/components/src/form/slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,15 @@ export default class Slider extends BaseElement implements IFormComponent {
}, 0)
}


attributeChangedCallback(name, oldVal, newVal) {
super.attributeChangedCallback(name, oldVal, newVal)

if (name === 'value' && oldVal!== newVal) {
this._init()
}
}

_init() {
const { left = 0, right = 350 } =
this.getClientRect('.tiga-slider-rail') || {}
Expand Down

0 comments on commit ec0cd19

Please sign in to comment.