Your IP : 216.73.216.229


Current Path : /home/jeromecohp/www/plugins/system/yooessentials/modules/core/app/fields/
Upload File :
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>