add verification
continuous-integration/drone/push Build is passing Details

master
adb-sh 2 years ago
parent 0d754f93f5
commit 96812e8844

@ -17,6 +17,7 @@ const item = reactive({
const form = ref(null); const form = ref(null);
const submit = () => { const submit = () => {
if (isValid.value === false) return;
store.items.push({ store.items.push({
name: item.name, name: item.name,
price: item.price * 100, price: item.price * 100,
@ -33,23 +34,31 @@ const submit = () => {
label="Item Name" label="Item Name"
required required
v-model="item.name" v-model="item.name"
validate-on="blur"
:rules="[v => !!v || 'Item is required']"
/> />
<v-text-field <v-text-field
label="Price" label="Price"
suffix="€" suffix="€"
required required
v-model="item.price" v-model="item.price"
validate-on="blur"
:rules="[v => !!v || 'Item is required']"
/> />
<v-text-field <v-text-field
label="Description" label="Description"
required required
v-model="item.description" v-model="item.description"
validate-on="blur"
:rules="[v => !!v || 'Item is required']"
/> />
<v-select <v-select
label="User" label="User"
:items="store.users.map(user => user.name)" :items="store.users.map(user => user.name)"
required required
v-model="item.user" v-model="item.user"
validate-on="blur"
:rules="[v => !!v || 'Item is required']"
/> />
<v-btn color="primary" @click="submit()">add item</v-btn> <v-btn color="primary" @click="submit()">add item</v-btn>
</v-form> </v-form>

@ -21,6 +21,8 @@ const item = reactive({
const form = ref(null); const form = ref(null);
const submit = () => { const submit = () => {
console.log(isValid.value)
if (isValid.value === false) return;
props.item.name = item.name; props.item.name = item.name;
props.item.price = item.price * 100; props.item.price = item.price * 100;
props.item.user = store.users.find(user => user.name === item.user); props.item.user = store.users.find(user => user.name === item.user);
@ -35,23 +37,31 @@ const submit = () => {
label="Item Name" label="Item Name"
required required
v-model="item.name" v-model="item.name"
validate-on="blur"
:rules="[v => !!v || 'Item is required']"
/> />
<v-text-field <v-text-field
label="Price" label="Price"
suffix="€" suffix="€"
required required
v-model="item.price" v-model="item.price"
validate-on="blur"
:rules="[v => !!v || 'Item is required']"
/> />
<v-text-field <v-text-field
label="Description" label="Description"
required required
v-model="item.description" v-model="item.description"
validate-on="blur"
:rules="[v => !!v || 'Item is required']"
/> />
<v-select <v-select
label="User" label="User"
:items="store.users.map(user => user.name)" :items="store.users.map(user => user.name)"
required required
v-model="item.user" v-model="item.user"
validate-on="blur"
:rules="[v => !!v || 'Item is required']"
/> />
<v-btn color="primary" @click="submit()">edit item</v-btn> <v-btn color="primary" @click="submit()">edit item</v-btn>
</v-form> </v-form>

Loading…
Cancel
Save