S
S
spacy fox2020-12-16 12:17:56
Vue.js
spacy fox, 2020-12-16 12:17:56

How to get the maximum and minimum value and pass it to the input parameters?

There is such a filter .
How can I get the maximum and minimum price values ​​('.filter__price') and pass these values ​​to the input parameters:

<input type="range" min="мин значение" max="макс значение">
?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0xD34F, 2020-12-16
@spacyfox

computed: {
  range() {
    const prices = this.filterData.map(n => n.price);
    return {
      min: Math.min(...prices),
      max: Math.max(...prices),
    };
  },
},

<input type="range" v-bind="range">

T
Tim, 2020-12-16
@Tim-A-2020

<input type="range" min="1" max="100" class="text" value="50">

const inp = document.querySelector('.text');
console.log(inp.max) // 100
console.log(inp.min)// 1
console.log(inp.value) // 50

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question