yandere_fe/src/components/settings_modal/helpers/number_setting.js

25 lines
489 B
JavaScript
Raw Normal View History

import Setting from './setting.js'
2022-03-07 20:02:53 -05:00
export default {
...Setting,
2022-03-07 20:02:53 -05:00
props: {
...Setting.props,
truncate: {
type: Number,
required: false,
default: 1
2022-03-07 20:02:53 -05:00
}
},
methods: {
...Setting.methods,
getValue (e) {
if (!this.truncate === 1) {
return parseInt(e.target.value)
} else if (this.truncate > 1) {
return Math.trunc(e.target.value / this.truncate) * this.truncate
}
return parseFloat(e.target.value)
2022-03-07 20:02:53 -05:00
}
}
}