Skip to content

Commit

Permalink
練習問題1の答えを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
mehm8128 committed Jun 15, 2023
1 parent 77b14bd commit f987b67
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/ItemList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ const items = ref<Item[]>([
const newItemName = ref('')
const newItemPrice = ref(0)
const addItem = () => {
if (newItemName.value === '' || newItemPrice.value === 0) return // buttonタグでdesabledを指定してもよい
items.value.push({ name: newItemName.value, price: newItemPrice.value })
newItemName.value = ''
newItemPrice.value = 0
}
</script>

Expand Down

0 comments on commit f987b67

Please sign in to comment.