I am using this package from git hub for minus plus input for vuejs and in v2 folder example there is a sample file named plusminusfield.vue and this is what I used for using it :
export default {
props: {
value: {
default: 0,
type: Number
},
base_capacity: {
type: Number,
required: true
},
min: {
default: here I want to use the sent variable which is defined above and that is base_capacity
if I send a hard code like 5 it works well but I want to make it dynamic
type:Number
},
max: {
default: 22,
type: Number
},
},
data(){
return {
newValue: this.base_capacity,
}
},
and here is the methods for minus plus the numbers of input and controlling the max and min values :
methods:{
getNotificationClass (notification) {
return `alert alert-${notification.type}`
},
mpminus: function () {
if ((this.newValue) > this.min) {
this.newValue = this.newValue - 1
this.$emit('input', this.newValue)
}
},
mpplus: function () {
if (this.max === undefined || (this.newValue < this.max)) {
this.newValue = this.newValue + 1
this.$emit('input', this.newValue)
}
},
},
watch: {
value: {
handler: function (newVal, oldVal) {
this.newValue = newVal
}
}
},
so if I define it any where else and I use it in props I get the mutant error which the parent component change it and my app wont run and if I use the computed like below I comment the error in front of them :
computed: {
min() {
return this.min ? this.min : this.base_capacity //Maximum call stack size exceeded
}
min : this.base_capacity // the error is base_capacity not defined
},
so is there any way that I pass the min for that input from the