mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-11-03 18:53:17 -05:00 
			
		
		
		
	Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com> Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
		
			
				
	
	
		
			62 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
<template>
 | 
						|
  <div
 | 
						|
    class="d-flex align-center"
 | 
						|
    style="max-width: 60px"
 | 
						|
  >
 | 
						|
    <v-text-field
 | 
						|
      v-model.number="quantity"
 | 
						|
      hide-details
 | 
						|
      :label="$t('form.quantity-label-abbreviated')"
 | 
						|
      :min="min"
 | 
						|
      :max="max"
 | 
						|
      type="number"
 | 
						|
      class="rounded-xl"
 | 
						|
      size="small"
 | 
						|
      variant="plain"
 | 
						|
    />
 | 
						|
  </div>
 | 
						|
</template>
 | 
						|
 | 
						|
<script lang="ts">
 | 
						|
export default defineNuxtComponent({
 | 
						|
  name: "VInputNumber",
 | 
						|
  props: {
 | 
						|
    min: {
 | 
						|
      type: Number,
 | 
						|
      default: 0,
 | 
						|
    },
 | 
						|
    max: {
 | 
						|
      type: Number,
 | 
						|
      default: 9999,
 | 
						|
    },
 | 
						|
    rules: {
 | 
						|
      type: Array,
 | 
						|
      default: () => [],
 | 
						|
    },
 | 
						|
    step: {
 | 
						|
      type: Number,
 | 
						|
      default: 1,
 | 
						|
    },
 | 
						|
    modelValue: {
 | 
						|
      type: Number,
 | 
						|
      default: 0,
 | 
						|
    },
 | 
						|
  },
 | 
						|
  emits: ["update:modelValue"],
 | 
						|
  setup(props, context) {
 | 
						|
    const quantity = computed({
 | 
						|
      get: () => {
 | 
						|
        return Number(props.modelValue);
 | 
						|
      },
 | 
						|
      set: (val) => {
 | 
						|
        context.emit("update:modelValue", val);
 | 
						|
      },
 | 
						|
    });
 | 
						|
 | 
						|
    return {
 | 
						|
      quantity,
 | 
						|
    };
 | 
						|
  },
 | 
						|
});
 | 
						|
</script>
 |