Files
mixtape/zero.Backoffice.UI/app/editor/fields/number.vue
T

36 lines
708 B
Vue
Raw Normal View History

2021-12-09 10:51:10 +01:00
<template>
2021-12-21 14:41:50 +01:00
<input :value="value" @input="onChange($event.target.value)" type="text" class="ui-input" v-placeholder="{ placeholder, model: config.model }" :maxlength="maxLength" :disabled="config.disabled" />
2021-12-09 10:51:10 +01:00
</template>
<script>
export default {
props: {
value: Number,
2021-12-21 14:41:50 +01:00
config: Object,
maxLength: {
type: Number,
default: null
},
placeholder: {
type: [String, Function],
default: null
}
2021-12-09 10:51:10 +01:00
},
methods: {
onChange(value)
{
var parsedValue = parseFloat(value);
if (isNaN(parsedValue))
{
return;
}
this.$emit('input', parsedValue);
}
}
}
</script>