airyland / airyland/vux

【Bug Report】Range组件动态设置min,max,计算value值出错

Open
#2,869 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Vue
Stars
17.5k
Forks
3.6k
PR merge metrics
No merged PRs in 30d

Description

问题描述:
1. 年收入input 框输入值: 20
2. PopupPicker选择值: 8
Range组件动态设置:
最小值-min:30,
最大值-max: 20 * 20 。即20倍年收入
当前值-value: 20 * 8 即 年收入 * PopupPicker选择值。 理应为160。但计算结果为170。

- popup-picker下拉选择
```js

```
- range组件
```js

```
- watch监听。
```js
watch: {
// 年限 ---监听。 下拉选择值之后,触发Range组件更新值。
familyReserve (val) {
console.log(`年限变化值....${val[0]}`)
if (this.yearIncome > 0) {
this.Step = parseInt(this.yearIncome, 10)
}
this.min = 30
this.max= this.yearIncome * 20
this.value = this.yearIncome * val[0]
},
```
debugger发现
每次设置 step,min,max,都会触发update方法。开始调用两次之后,value值(160)是正确的。但会立即刷新到另外一个值(170)。具体原因还没有找到。

如图:
![image](https://user-images.githubusercontent.com/8072471/41634909-83fe7ffe-7478-11e8-9976-5480c2db6e97.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.