summaryrefslogtreecommitdiff
path: root/src/routes/tools/UuidGenerator.vue
diff options
context:
space:
mode:
authorGravatar Corentin Thomasset <corentin.thomasset74@gmail.com> 2020-06-08 20:03:15 +0200
committerGravatar Corentin Thomasset <corentin.thomasset74@gmail.com> 2020-06-09 08:09:36 +0200
commitf6d8dc41e6d0e2e67dc150a88cc82630174b98ad (patch)
tree4bdb4177a50b755289c54244cd91f634b1664674 /src/routes/tools/UuidGenerator.vue
parente51a37844ab5344af615ecb6c8f6b7a25be5cdbc (diff)
downloadit-tools-f6d8dc41e6d0e2e67dc150a88cc82630174b98ad.tar.gz
it-tools-f6d8dc41e6d0e2e67dc150a88cc82630174b98ad.tar.zst
it-tools-f6d8dc41e6d0e2e67dc150a88cc82630174b98ad.zip
fix: added quantity validation rules
Signed-off-by: Corentin Thomasset <corentin.thomasset74@gmail.com>
Diffstat (limited to '')
-rw-r--r--src/routes/tools/UuidGenerator.vue25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/routes/tools/UuidGenerator.vue b/src/routes/tools/UuidGenerator.vue
index c4b3f1b..16df536 100644
--- a/src/routes/tools/UuidGenerator.vue
+++ b/src/routes/tools/UuidGenerator.vue
@@ -3,8 +3,17 @@
<v-card-title>Uuid v4 generator</v-card-title>
<v-card-text>
- <v-text-field outlined v-model="quantity" type="number" label="Quantity" dense class="quantity"/>
- <v-textarea outlined v-model="token" class="centered-input" :rows="quantity <= 10 ? quantity : 10" readonly/>
+ <v-text-field
+ outlined
+ v-model="quantity"
+ type="number"
+ label="Quantity"
+ dense
+ class="quantity"
+ :rules="rules.quantity"
+ />
+ <v-textarea outlined v-model="token" class="centered-input" :rows="quantity <= 10 ? quantity : 10"
+ readonly/>
<div class="text-center">
<v-btn @click="refreshBool = !refreshBool" depressed class="mr-4">Refresh</v-btn>
@@ -26,7 +35,13 @@
name: "UuidGenerator",
data: () => ({
refreshBool: true,
- quantity: 1
+ quantity: 1,
+ rules: {
+ quantity: [
+ v => !!v || 'Quantity is required',
+ v => v > 0 || 'Quantity should be > 0'
+ ]
+ }
}),
methods: {
copyToken() {
@@ -45,12 +60,12 @@
</script>
<style scoped lang="less">
- .quantity{
+ .quantity {
width: 100px;
margin: auto;
text-align: center;
- ::v-deep input{
+ ::v-deep input {
text-align: center;
}
}