Blame view

src/components/slider/slider.vue 16.2 KB
36febc3c   梁灏   add Slider
1
2
  <template>
      <div :class="classes">
69576f47   梁灏   add Slider component
3
4
5
          <Input-number
              v-if="!range && showInput"
              :min="min"
f672c42b   Vace   add props input-size
6
              :size="inputSize"
69576f47   梁灏   add Slider component
7
8
              :max="max"
              :step="step"
e3549149   Sergio Crisostomo   normalise public ...
9
              :value="exportValue[0]"
69576f47   梁灏   add Slider component
10
              :disabled="disabled"
bc56b632   梁灏   fix #5583
11
              :active-change="activeChange"
69576f47   梁灏   add Slider component
12
              @on-change="handleInputChange"></Input-number>
791d254e   Graham Fairweather   Slider: Keyboard ...
13
14
15
16
          <div
              :class="[prefixCls + '-wrap']"
              ref="slider" @click.self="sliderClick"
          >
e3549149   Sergio Crisostomo   normalise public ...
17
              <input type="hidden" :name="name" :value="exportValue">
36febc3c   梁灏   add Slider
18
              <template v-if="showStops">
791d254e   Graham Fairweather   Slider: Keyboard ...
19
20
21
22
23
24
                  <div
                      :class="[prefixCls + '-stop']"
                      v-for="item in stops"
                      :style="{ 'left': item + '%' }"
                      @click.self="sliderClick"
                  ></div>
36febc3c   梁灏   add Slider
25
              </template>
791d254e   Graham Fairweather   Slider: Keyboard ...
26
27
28
29
              <div
                  :class="[prefixCls + '-bar']"
                  :style="barStyle"
                  @click.self="sliderClick"></div>
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
30
31
32
33
34
              <div
                  :class="[prefixCls + '-button-wrap']"
                  :style="{left: minPosition + '%'}"
                  @touchstart="onPointerDown($event, 'min')"
                  @mousedown="onPointerDown($event, 'min')">
791d254e   Graham Fairweather   Slider: Keyboard ...
35
36
37
38
39
40
41
42
43
44
45
                  <Tooltip
                      :controlled="pointerDown === 'min'"
                      placement="top"
                      :content="tipFormat(exportValue[0])"
                      :disabled="tipDisabled"
                      :always="showTip === 'always'"
                      ref="minTooltip"
                  >
                      <div
                          :class="minButtonClasses"
                          tabindex="0"
5cb6ce9e   梁灏   Slider add Toolti...
46
47
                          @focus="handleFocus('min')"
                          @blur="handleBlur('min')"
791d254e   Graham Fairweather   Slider: Keyboard ...
48
49
50
51
52
                          @keydown.left="onKeyLeft($event, 'min')"
                          @keydown.down="onKeyLeft($event, 'min')"
                          @keydown.right="onKeyRight($event, 'min')"
                          @keydown.up="onKeyRight($event, 'min')"
                      ></div>
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
53
54
55
56
57
58
59
                  </Tooltip>
              </div>
              <div v-if="range"
                   :class="[prefixCls + '-button-wrap']"
                   :style="{left: maxPosition + '%'}"
                   @touchstart="onPointerDown($event, 'max')"
                   @mousedown="onPointerDown($event, 'max')">
791d254e   Graham Fairweather   Slider: Keyboard ...
60
61
62
63
64
65
66
67
68
69
70
                  <Tooltip
                      :controlled="pointerDown === 'max'"
                      placement="top"
                      :content="tipFormat(exportValue[1])"
                      :disabled="tipDisabled"
                      :always="showTip === 'always'"
                      ref="maxTooltip"
                  >
                      <div
                          :class="maxButtonClasses"
                          tabindex="0"
5cb6ce9e   梁灏   Slider add Toolti...
71
72
                          @focus="handleFocus('max')"
                          @blur="handleBlur('max')"
791d254e   Graham Fairweather   Slider: Keyboard ...
73
74
75
76
77
                          @keydown.left="onKeyLeft($event, 'max')"
                          @keydown.down="onKeyLeft($event, 'max')"
                          @keydown.right="onKeyRight($event, 'max')"
                          @keydown.up="onKeyRight($event, 'max')"
                      ></div>
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
78
79
                  </Tooltip>
              </div>
36febc3c   梁灏   add Slider
80
81
82
83
84
85
          </div>
      </div>
  </template>
  <script>
      import InputNumber from '../../components/input-number/input-number.vue';
      import Tooltip from '../../components/tooltip/tooltip.vue';
59872199   Rijn   added show-tip to...
86
      import { getStyle, oneOf } from '../../utils/assist';
825ed580   梁灏   fixed bug
87
      import { on, off } from '../../utils/dom';
cd78c9c4   梁灏   some comps suppor...
88
      import Emitter from '../../mixins/emitter';
6337de26   梁灏   fix Slider bug, c...
89
      import elementResizeDetectorMaker from 'element-resize-detector';
36febc3c   梁灏   add Slider
90
91
92
93
  
      const prefixCls = 'ivu-slider';
  
      export default {
b1c118d8   梁灏   support Dropdown
94
          name: 'Slider',
cd78c9c4   梁灏   some comps suppor...
95
          mixins: [ Emitter ],
36febc3c   梁灏   add Slider
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
          components: { InputNumber, Tooltip },
          props: {
              min: {
                  type: Number,
                  default: 0
              },
              max: {
                  type: Number,
                  default: 100
              },
              step: {
                  type: Number,
                  default: 1
              },
              range: {
                  type: Boolean,
                  default: false
              },
              value: {
                  type: [Number, Array],
                  default: 0
              },
              disabled: {
                  type: Boolean,
                  default: false
              },
              showInput: {
                  type: Boolean,
                  default: false
              },
f672c42b   Vace   add props input-size
126
127
128
129
130
131
132
              inputSize: {
                  type: String,
                  default: 'default',
                  validator (value) {
                      return oneOf(value, ['small', 'large', 'default']);
                  }
              },
36febc3c   梁灏   add Slider
133
134
135
136
137
138
139
140
141
              showStops: {
                  type: Boolean,
                  default: false
              },
              tipFormat: {
                  type: Function,
                  default (val) {
                      return val;
                  }
59872199   Rijn   added show-tip to...
142
143
144
145
146
147
148
              },
              showTip: {
                  type: String,
                  default: 'hover',
                  validator (value) {
                      return oneOf(value, ['hover', 'always', 'never']);
                  }
0460a1e8   梁灏   fixed #812
149
150
151
              },
              name: {
                  type: String
bc56b632   梁灏   fix #5583
152
153
154
155
156
              },
              // 3.4.0
              activeChange: {
                  type: Boolean,
                  default: true
36febc3c   梁灏   add Slider
157
158
159
              }
          },
          data () {
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
160
              const val = this.checkLimits(Array.isArray(this.value) ? this.value : [this.value]);
36febc3c   梁灏   add Slider
161
              return {
69576f47   梁灏   add Slider component
162
                  prefixCls: prefixCls,
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
163
                  currentValue: val,
69576f47   梁灏   add Slider component
164
                  dragging: false,
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
165
                  pointerDown: '',
69576f47   梁灏   add Slider component
166
167
168
                  startX: 0,
                  currentX: 0,
                  startPos: 0,
42ab875d   miomio-xiao   fix Slider not em...
169
                  oldValue: [...val],
791d254e   Graham Fairweather   Slider: Keyboard ...
170
171
172
173
                  valueIndex: {
                      min: 0,
                      max: 1,
                  },
6337de26   梁灏   fix Slider bug, c...
174
                  sliderWidth: 0
b0893113   jingsam   :art: add eslint
175
              };
36febc3c   梁灏   add Slider
176
          },
1c803cdf   梁灏   support Slider
177
178
          watch: {
              value (val) {
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
179
                  val = this.checkLimits(Array.isArray(val) ? val : [val]);
f2d08714   2hu   Fix race conditio...
180
                  if (!this.dragging && (val[0] !== this.currentValue[0] || val[1] !== this.currentValue[1])) {
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
181
182
                      this.currentValue = val;
                  }
1c803cdf   梁灏   support Slider
183
              },
e3549149   Sergio Crisostomo   normalise public ...
184
              exportValue (values) {
1c803cdf   梁灏   support Slider
185
                  this.$nextTick(() => {
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
186
                      this.$refs.minTooltip.updatePopper();
1c803cdf   梁灏   support Slider
187
                      if (this.range) {
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
188
                          this.$refs.maxTooltip.updatePopper();
1c803cdf   梁灏   support Slider
189
190
                      }
                  });
e3549149   Sergio Crisostomo   normalise public ...
191
192
193
                  const value = this.range ? values : values[0];
                  this.$emit('input', value);
                  this.$emit('on-input', value);
1c803cdf   梁灏   support Slider
194
195
              }
          },
36febc3c   梁灏   add Slider
196
197
198
199
200
          computed: {
              classes () {
                  return [
                      `${prefixCls}`,
                      {
69576f47   梁灏   add Slider component
201
                          [`${prefixCls}-input`]: this.showInput && !this.range,
36febc3c   梁灏   add Slider
202
203
204
                          [`${prefixCls}-range`]: this.range,
                          [`${prefixCls}-disabled`]: this.disabled
                      }
b0893113   jingsam   :art: add eslint
205
                  ];
36febc3c   梁灏   add Slider
206
              },
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
207
              minButtonClasses () {
69576f47   梁灏   add Slider component
208
209
210
                  return [
                      `${prefixCls}-button`,
                      {
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
211
                          [`${prefixCls}-button-dragging`]: this.pointerDown === 'min'
69576f47   梁灏   add Slider component
212
213
214
                      }
                  ];
              },
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
215
              maxButtonClasses () {
69576f47   梁灏   add Slider component
216
217
218
                  return [
                      `${prefixCls}-button`,
                      {
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
219
                          [`${prefixCls}-button-dragging`]: this.pointerDown === 'max'
69576f47   梁灏   add Slider component
220
221
222
                      }
                  ];
              },
e3549149   Sergio Crisostomo   normalise public ...
223
224
225
226
              exportValue(){
                  const decimalCases = (String(this.step).split('.')[1] || '').length;
                  return this.currentValue.map(nr => Number(nr.toFixed(decimalCases)));
              },
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
227
228
              minPosition () {
                  const val = this.currentValue;
965b6d8e   Sergio Crisostomo   Fix slider for m...
229
                  return (val[0] - this.min) / this.valueRange * 100;
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
230
231
232
233
              },
              maxPosition: function () {
                  const val = this.currentValue;
  
965b6d8e   Sergio Crisostomo   Fix slider for m...
234
                  return (val[1] - this.min) / this.valueRange * 100;
69576f47   梁灏   add Slider component
235
              },
36febc3c   梁灏   add Slider
236
              barStyle () {
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
237
                  const style = {
965b6d8e   Sergio Crisostomo   Fix slider for m...
238
                      width: (this.currentValue[0] - this.min) / this.valueRange * 100 + '%'
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
239
                  };
36febc3c   梁灏   add Slider
240
241
  
                  if (this.range) {
965b6d8e   Sergio Crisostomo   Fix slider for m...
242
243
                      style.left = (this.currentValue[0] - this.min) / this.valueRange * 100 + '%';
                      style.width = (this.currentValue[1] - this.currentValue[0]) / this.valueRange * 100 + '%';
36febc3c   梁灏   add Slider
244
245
246
247
                  }
  
                  return style;
              },
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
248
              stops () {
965b6d8e   Sergio Crisostomo   Fix slider for m...
249
                  let stopCount = this.valueRange / this.step;
41d90ccf   梁灏   Slider can show s...
250
                  let result = [];
965b6d8e   Sergio Crisostomo   Fix slider for m...
251
                  let stepWidth = 100 * this.step / this.valueRange;
41d90ccf   梁灏   Slider can show s...
252
253
254
255
                  for (let i = 1; i < stopCount; i++) {
                      result.push(i * stepWidth);
                  }
                  return result;
69576f47   梁灏   add Slider component
256
              },
59872199   Rijn   added show-tip to...
257
              tipDisabled () {
1c803cdf   梁灏   support Slider
258
                  return this.tipFormat(this.currentValue[0]) === null || this.showTip === 'never';
965b6d8e   Sergio Crisostomo   Fix slider for m...
259
              },
69745a3c   梁灏   Update slider.vue
260
              valueRange () {
965b6d8e   Sergio Crisostomo   Fix slider for m...
261
                  return this.max - this.min;
69745a3c   梁灏   Update slider.vue
262
263
264
265
266
267
              },
              firstPosition () {
                  return this.currentValue[0];
              },
              secondPosition () {
                  return this.currentValue[1];
36febc3c   梁灏   add Slider
268
269
270
              }
          },
          methods: {
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
271
272
              getPointerX (e) {
                  return e.type.indexOf('touch') !== -1 ? e.touches[0].clientX : e.clientX;
69576f47   梁灏   add Slider component
273
              },
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
274
              checkLimits ([min, max]) {
965b6d8e   Sergio Crisostomo   Fix slider for m...
275
276
                  min = Math.max(this.min, min);
                  min = Math.min(this.max, min);
36febc3c   梁灏   add Slider
277
  
965b6d8e   Sergio Crisostomo   Fix slider for m...
278
279
                  max = Math.max(this.min, min, max);
                  max = Math.min(this.max, max);
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
280
                  return [min, max];
69576f47   梁灏   add Slider component
281
              },
791d254e   Graham Fairweather   Slider: Keyboard ...
282
              getCurrentValue (event, type) {
5cb6ce9e   梁灏   Slider add Toolti...
283
284
285
                  if (this.disabled) {
                      return;
                  }
791d254e   Graham Fairweather   Slider: Keyboard ...
286
  
5cb6ce9e   梁灏   Slider add Toolti...
287
288
289
290
                  const index = this.valueIndex[type];
                  if (typeof index === 'undefined') {
                      return;
                  }
791d254e   Graham Fairweather   Slider: Keyboard ...
291
  
5cb6ce9e   梁灏   Slider add Toolti...
292
                  return this.currentValue[index];
791d254e   Graham Fairweather   Slider: Keyboard ...
293
294
              },
              onKeyLeft (event, type) {
5cb6ce9e   梁灏   Slider add Toolti...
295
296
297
298
                  const value = this.getCurrentValue(event, type);
                  if (Number.isFinite(value)) {
                      this.changeButtonPosition(value - this.step, type);
                  }
791d254e   Graham Fairweather   Slider: Keyboard ...
299
300
              },
              onKeyRight (event, type) {
5cb6ce9e   梁灏   Slider add Toolti...
301
302
303
304
                  const value = this.getCurrentValue(event, type);
                  if (Number.isFinite(value)) {
                      this.changeButtonPosition(value + this.step, type);
                  }
791d254e   Graham Fairweather   Slider: Keyboard ...
305
              },
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
306
              onPointerDown (event, type) {
69576f47   梁灏   add Slider component
307
                  if (this.disabled) return;
f2be585e   梁灏   optimize Slider w...
308
                  event.preventDefault();
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
309
310
311
312
313
314
315
                  this.pointerDown = type;
  
                  this.onPointerDragStart(event);
                  on(window, 'mousemove', this.onPointerDrag);
                  on(window, 'touchmove', this.onPointerDrag);
                  on(window, 'mouseup', this.onPointerDragEnd);
                  on(window, 'touchend', this.onPointerDragEnd);
69576f47   梁灏   add Slider component
316
              },
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
317
              onPointerDragStart (event) {
ce4c0faa   oustn   修复 Slider 滑动按钮单击时...
318
                  this.dragging = false;
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
319
                  this.startX = this.getPointerX(event);
965b6d8e   Sergio Crisostomo   Fix slider for m...
320
                  this.startPos = (this[`${this.pointerDown}Position`] * this.valueRange / 100) + this.min;
69576f47   梁灏   add Slider component
321
              },
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
322
              onPointerDrag (event) {
ce4c0faa   oustn   修复 Slider 滑动按钮单击时...
323
                  this.dragging = true;
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
324
325
                  this.$refs[`${this.pointerDown}Tooltip`].visible = true;
                  this.currentX = this.getPointerX(event);
965b6d8e   Sergio Crisostomo   Fix slider for m...
326
                  const diff = (this.currentX - this.startX) / this.sliderWidth * this.valueRange;
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
327
  
965b6d8e   Sergio Crisostomo   Fix slider for m...
328
                  this.changeButtonPosition(this.startPos + diff);
69576f47   梁灏   add Slider component
329
              },
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
330
              onPointerDragEnd () {
69576f47   梁灏   add Slider component
331
332
                  if (this.dragging) {
                      this.dragging = false;
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
333
                      this.$refs[`${this.pointerDown}Tooltip`].visible = false;
b964efae   Sergio Crisostomo   Emit change on po...
334
                      this.emitChange();
69576f47   梁灏   add Slider component
335
                  }
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
336
337
338
339
340
341
  
                  this.pointerDown = '';
                  off(window, 'mousemove', this.onPointerDrag);
                  off(window, 'touchmove', this.onPointerDrag);
                  off(window, 'mouseup', this.onPointerDragEnd);
                  off(window, 'touchend', this.onPointerDragEnd);
69576f47   梁灏   add Slider component
342
              },
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
343
              changeButtonPosition (newPos, forceType) {
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
344
345
                  const type = forceType || this.pointerDown;
                  const index = type === 'min' ? 0 : 1;
166dbc56   Sergio Crisostomo   Correct values pa...
346
347
                  if (type === 'min') newPos = this.checkLimits([newPos, this.max])[0];
                  else newPos = this.checkLimits([this.min, newPos])[1];
d4c9b17b   miomio-xiao   fix Slider组件第一次cl...
348
  
cd077424   bin.yang   slider组件 step为小数...
349
                  const modulus = this.handleDecimal(newPos,this.step);
42ab875d   miomio-xiao   fix Slider not em...
350
                  const value = this.currentValue;
eb8c6cd9   Sergio Crisostomo   Correct steps cal...
351
                  value[index] = newPos - modulus;
eb6d85be   梁灏   fix #4281
352
353
354
355
356
357
358
  
                  // 判断左右是否相等,否则会出现左边大于右边的情况
                  if (this.range) {
                      if (type === 'min' && value[0] > value[1]) value[1] = value[0];
                      if (type === 'max' && value[0] > value[1]) value[0] = value[1];
                  }
  
42ab875d   miomio-xiao   fix Slider not em...
359
                  this.currentValue = [...value];
d4c9b17b   miomio-xiao   fix Slider组件第一次cl...
360
  
a6fc9438   梁灏   fixed #461
361
                  if (!this.dragging) {
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
362
                      if (this.currentValue[index] !== this.oldValue[index]) {
b964efae   Sergio Crisostomo   Emit change on po...
363
                          this.emitChange();
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
364
                          this.oldValue[index] = this.currentValue[index];
69576f47   梁灏   add Slider component
365
366
367
                      }
                  }
              },
3b71312a   bin.yang   slider组件 step为小数...
368
369
370
371
              handleDecimal(pos,step){
                  if(step<1){
                      let sl = step.toString(),
                          multiple = 1,
cd077424   bin.yang   slider组件 step为小数...
372
                          m;
3b71312a   bin.yang   slider组件 step为小数...
373
                      try {
cd077424   bin.yang   slider组件 step为小数...
374
375
376
377
                          m = sl.split('.')[1].length;
                      } catch (e){
                          m = 0;
                      }
3b71312a   bin.yang   slider组件 step为小数...
378
379
380
381
                      multiple = Math.pow(10,m);
                      return (pos * multiple) % (step * multiple) / multiple;
                  }else return  pos % step;
              },
b964efae   Sergio Crisostomo   Emit change on po...
382
              emitChange(){
e3549149   Sergio Crisostomo   normalise public ...
383
384
385
                  const value = this.range ? this.exportValue : this.exportValue[0];
                  this.$emit('on-change', value);
                  this.dispatch('FormItem', 'on-form-change', value);
b964efae   Sergio Crisostomo   Emit change on po...
386
387
              },
  
2eccfc99   梁灏   fixed #2852
388
              sliderClick (event) {
69576f47   梁灏   add Slider component
389
                  if (this.disabled) return;
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
390
391
                  const currentX = this.getPointerX(event);
                  const sliderOffsetLeft = this.$refs.slider.getBoundingClientRect().left;
965b6d8e   Sergio Crisostomo   Fix slider for m...
392
                  let newPos = ((currentX - sliderOffsetLeft) / this.sliderWidth * this.valueRange) + this.min;
2e3a7bf5   Haven   fix(slider): clic...
393
                  let regularNewPos = newPos / this.valueRange * 100 ;
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
394
  
2e3a7bf5   Haven   fix(slider): clic...
395
396
                  if (!this.range || regularNewPos <= this.minPosition) this.changeButtonPosition(newPos, 'min');
                  else if (regularNewPos >= this.maxPosition) this.changeButtonPosition(newPos, 'max');
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
397
                  else this.changeButtonPosition(newPos, ((newPos - this.firstPosition) <= (this.secondPosition - newPos)) ? 'min' : 'max');
69576f47   梁灏   add Slider component
398
              },
69576f47   梁灏   add Slider component
399
  
2b87ffa9   Sergio Crisostomo   refactor and DRY ...
400
              handleInputChange (val) {
3f243f02   Jongyoon Jeong   Issue 5002
401
                  this.currentValue = [val === 0 ? 0 : val || this.min, this.currentValue[1]];
e3549149   Sergio Crisostomo   normalise public ...
402
                  this.emitChange();
69576f47   梁灏   add Slider component
403
              },
5cb6ce9e   梁灏   Slider add Toolti...
404
405
406
407
408
409
410
  
              handleFocus (type) {
                  this.$refs[`${type}Tooltip`].handleShowPopper();
              },
  
              handleBlur (type) {
                  this.$refs[`${type}Tooltip`].handleClosePopper();
6337de26   梁灏   fix Slider bug, c...
411
412
413
414
              },
              handleSetSliderWidth () {
                  this.sliderWidth = parseInt(getStyle(this.$refs.slider, 'width'), 10);
              },
2eccfc99   梁灏   fixed #2852
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
          },
          mounted () {
              // #2852
              this.$on('on-visible-change', (val) => {
                  if (val && this.showTip === 'always') {
                      this.$refs.minTooltip.doDestroy();
                      if (this.range) {
                          this.$refs.maxTooltip.doDestroy();
                      }
                      this.$nextTick(() => {
                          this.$refs.minTooltip.updatePopper();
                          if (this.range) {
                              this.$refs.maxTooltip.updatePopper();
                          }
                      });
                  }
              });
6337de26   梁灏   fix Slider bug, c...
432
433
434
435
436
437
  
              this.observer = elementResizeDetectorMaker();
              this.observer.listenTo(this.$refs.slider, this.handleSetSliderWidth);
          },
          beforeDestroy() {
              this.observer.removeListener(this.$refs.slider, this.handleSetSliderWidth);
36febc3c   梁灏   add Slider
438
          }
b0893113   jingsam   :art: add eslint
439
440
      };
  </script>