Update index.js
This commit is contained in:
16
index.js
16
index.js
@@ -1,6 +1,6 @@
|
||||
class IdmQuantityPicker{
|
||||
constructor({selector , min = 1, max = 99}) {
|
||||
const container = document.querySelector(selector);
|
||||
constructor({selector , min, max, ref}) {
|
||||
const container = selector ? document.querySelector(selector) : ref;
|
||||
if(!container){
|
||||
console.error("IdmQuantityPicker: container not found.");
|
||||
return;
|
||||
@@ -13,6 +13,18 @@ class IdmQuantityPicker{
|
||||
}
|
||||
this.input = input;
|
||||
|
||||
if(typeof min === "undefined"){
|
||||
min = this.input.min;
|
||||
}else{
|
||||
this.input.min=min;
|
||||
}
|
||||
|
||||
if(typeof min === "undefined"){
|
||||
max = this.input.max;
|
||||
}else{
|
||||
this.input.max=max;
|
||||
}
|
||||
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this._value = Number.parseInt(input.value);
|
||||
|
||||
Reference in New Issue
Block a user