Files
PhotonVision/photon-client/src/components/common/cv-number-input.vue

58 lines
1.2 KiB
Vue
Raw Normal View History

2019-09-28 21:42:04 +03:00
<template>
<div>
<v-row
dense
align="center"
>
<v-col :cols="labelCols || 2">
<tooltipped-label
:tooltip="tooltip"
:text="name"
/>
</v-col>
<v-col>
<v-text-field
v-model="localValue"
dark
class="mt-0 pt-0"
hide-details
single-line
color="accent"
type="number"
style="width: 70px"
:step="step"
:disabled="disabled"
:rules="rules"
/>
</v-col>
</v-row>
</div>
2019-09-28 21:42:04 +03:00
</template>
<script>
import TooltippedLabel from "./cv-tooltipped-label";
2019-09-28 21:42:04 +03:00
export default {
name: 'NumberInput',
components: {
TooltippedLabel,
2019-09-28 21:42:04 +03:00
},
// eslint-disable-next-line vue/require-prop-types
props: ['name', 'value', 'step', 'labelCols', 'rules', 'tooltip', 'disabled'],
2019-10-29 23:58:06 +02:00
computed: {
localValue: {
get() {
2019-09-28 21:42:04 +03:00
return this.value;
},
2019-10-29 23:58:06 +02:00
set(value) {
this.$emit('input', parseFloat(value));
2019-09-28 21:42:04 +03:00
}
}
}
}
</script>
<style lang="" scoped>
2019-10-29 23:58:06 +02:00
</style>