Skip to content

Commit

Permalink
improve NumberPicker (close #115)
Browse files Browse the repository at this point in the history
  • Loading branch information
userXinos committed Jun 27, 2024
1 parent 2e467c9 commit 121cabd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/components/NumberPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/>
<div class="input-wrap">
<input
ref="inputRef"
type="text"
:value="value"
@change="checkAndSend(parseInt($event.target.value))"
Expand All @@ -19,13 +20,21 @@
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue';
export interface Props {
value: number,
min: number,
max: number,
}
const props = defineProps<Props>();
const emit = defineEmits(['update:value']);
const inputRef = ref<HTMLInputElement>();
onMounted(() => {
inputRef.value.focus();
inputRef.value.select();
});
function checkAndSend(num: number) {
if (num < props.min) {
Expand Down

0 comments on commit 121cabd

Please sign in to comment.