Skip to content

Commit 09c234e

Browse files
committedJul 28, 2022
fix: disable generate button when empty
1 parent 8d5b46d commit 09c234e

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed
 

‎src/App.vue

+7-5
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
})
1616
1717
const handleSubmit = (newList: OreoKey[]) => {
18-
loading = true
19-
setTimeout(() => {
20-
loading = false
21-
}, 1000)
18+
if(newList.length) {
19+
loading = true
20+
setTimeout(() => {
21+
loading = false
22+
}, 1000)
2223
23-
oreoList = [...newList]
24+
oreoList = [...newList]
25+
}
2426
}
2527
</script>
2628

‎src/pages/Home.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ const generateRandomOreo = () => {
107107
h-16 mx="-8" mb="-8"
108108
text="white xl"
109109
bg-truegray-700
110-
cursor-pointer
111-
hover="bg-truegray-800 text-2xl" rounded-b-xl
110+
:cursor="oreoList.length ? 'pointer' : 'not-allowed'"
111+
:hover="oreoList.length ? 'bg-truegray-800 text-2xl' : ''"
112+
rounded-b-xl select-none
112113
@click="handleClick"
113114
>
114115
{{ t('input.generate') }}

0 commit comments

Comments
 (0)
Please sign in to comment.