fix: added quantity validation rules

Signed-off-by: Corentin Thomasset <corentin.thomasset74@gmail.com>
This commit is contained in:
Corentin Thomasset 2020-06-08 20:03:15 +02:00 committed by Corentin THOMASSET
parent e51a37844a
commit aa4fb5ffff
2 changed files with 23 additions and 5 deletions

View file

@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Next
- [fix] [UuidGenerator] added quantity validation rules (prevent < 0)
## 1.2.0 ## 1.2.0
- [feat] [UuidGenerator] can generate multiple uuids - [feat] [UuidGenerator] can generate multiple uuids

View file

@ -3,8 +3,17 @@
<v-card-title>Uuid v4 generator</v-card-title> <v-card-title>Uuid v4 generator</v-card-title>
<v-card-text> <v-card-text>
<v-text-field outlined v-model="quantity" type="number" label="Quantity" dense class="quantity"/> <v-text-field
<v-textarea outlined v-model="token" class="centered-input" :rows="quantity <= 10 ? quantity : 10" readonly/> 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"> <div class="text-center">
<v-btn @click="refreshBool = !refreshBool" depressed class="mr-4">Refresh</v-btn> <v-btn @click="refreshBool = !refreshBool" depressed class="mr-4">Refresh</v-btn>
@ -26,7 +35,13 @@
name: "UuidGenerator", name: "UuidGenerator",
data: () => ({ data: () => ({
refreshBool: true, refreshBool: true,
quantity: 1 quantity: 1,
rules: {
quantity: [
v => !!v || 'Quantity is required',
v => v > 0 || 'Quantity should be > 0'
]
}
}), }),
methods: { methods: {
copyToken() { copyToken() {
@ -45,12 +60,12 @@
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.quantity{ .quantity {
width: 100px; width: 100px;
margin: auto; margin: auto;
text-align: center; text-align: center;
::v-deep input{ ::v-deep input {
text-align: center; text-align: center;
} }
} }