| Current Path : /home/jeromecohp/www/plugins/system/yooessentials/modules/core/app/fields/ |
| Current File : /home/jeromecohp/www/plugins/system/yooessentials/modules/core/app/fields/NumberField.vue |
<template>
<input v-model="val" v-bind="attributes" class="uk-input" type="number" />
</template>
<script>
import yootheme from 'yootheme';
import { isNumeric, toFloat } from 'uikit-util';
export default {
extends: yootheme.fields.components.FieldText,
computed: {
mod() {
return toFloat(this.field.modifier || 0);
},
val: {
get() {
return isNumeric(this.value) ? toFloat(this.value) + this.mod : this.value;
},
set(value) {
this.value = isNumeric(value) ? toFloat(value) - this.mod : undefined;
},
},
},
};
</script>