add review system #3
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<h3>How did you like todays TLA?</h3>
|
<h3>Did you enjoy todays TLA?</h3>
|
||||||
<div>
|
<div>
|
||||||
<UButton @click="makeRequest(1)" class="rounded-l-full" :icon="current == 1 ? 'mdi:thumbs-up' : 'mdi:thumbs-up-outline'" size="md" color="neutral" variant="outline">{{ likes }}</UButton>
|
<UButton @click="makeRequest(1)" class="rounded-l-full" :icon="current == 1 ? 'mdi:thumbs-up' : 'mdi:thumbs-up-outline'" size="md" color="neutral" variant="outline">{{ likes }}</UButton>
|
||||||
<UButton @click="makeRequest(-1)" class="rounded-r-full" :icon="current == -1 ? 'mdi:thumbs-down' : 'mdi:thumbs-down-outline'" size="md" color="neutral" variant="outline">{{ dislikes }}</UButton>
|
<UButton @click="makeRequest(-1)" class="rounded-r-full" :icon="current == -1 ? 'mdi:thumbs-down' : 'mdi:thumbs-down-outline'" size="md" color="neutral" variant="outline">{{ dislikes }}</UButton>
|
||||||
@@ -26,23 +26,25 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
makeRequest(type: number) {
|
makeRequest(type: number) {
|
||||||
if (this.current == type){
|
if (type != 0){
|
||||||
this.current = 0;
|
if (this.current == type){
|
||||||
if (type == 1) this.likes--;
|
this.current = 0;
|
||||||
else if (type == -1) this.dislikes--;
|
if (type == 1) this.likes--;
|
||||||
}
|
else if (type == -1) this.dislikes--;
|
||||||
else
|
|
||||||
{
|
|
||||||
if (type == 1) {
|
|
||||||
this.likes++;
|
|
||||||
if (this.current != 0) this.dislikes--;
|
|
||||||
}
|
|
||||||
else if (type == -1) {
|
|
||||||
this.dislikes++;
|
|
||||||
if (this.current != 0) this.likes--;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (type == 1) {
|
||||||
|
this.likes++;
|
||||||
|
if (this.current != 0) this.dislikes--;
|
||||||
|
}
|
||||||
|
else if (type == -1) {
|
||||||
|
this.dislikes++;
|
||||||
|
if (this.current != 0) this.likes--;
|
||||||
|
}
|
||||||
|
|
||||||
this.current = type;
|
this.current = type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
axios
|
axios
|
||||||
|
|||||||
Reference in New Issue
Block a user