有几个问题,
第一:怎么控制输入的只能是整数;
第二:怎么控制最大不能超过 max
的值,最少不能小于 1
<template>
<div>
<div id="list">
<input v-for="(item, index) in list" v-model="item.number" @change="_ceshi" />
</div>
</div>
</template>
<script>
export default {
name: "Test",
data() {
return {
list:[
{
id:1,
name:"a",
number:1,
max:23
},
{
id:2,
name:"b",
number:1,
max:234
},
{
id:3,
name:"c",
number:1,
max:2
},
]
}
},
methods: {
_ceshi() {
console.log(JSON.stringify(this.list))
}
},
mounted() {
}
}
</script>
<style scoped>
</style>