From 3e8e20db8f6a90536f271c1e5e94d414b6e4e79e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=93=E8=B4=A5=E5=A4=A7=E7=8B=97=E7=86=8A?= Date: Mon, 4 Dec 2023 12:35:08 +0800 Subject: [PATCH] update to 1.0.3 --- src/components/inputBox.vue | 4 ++-- src/views/HomeView.vue | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/inputBox.vue b/src/components/inputBox.vue index cabb38a..38ba824 100644 --- a/src/components/inputBox.vue +++ b/src/components/inputBox.vue @@ -4,7 +4,7 @@ - +
我填好了啦 ^_^
@@ -102,7 +102,7 @@ if (parseFloat(num) != parseInt(num)) return vuemsg('数量不能有小数'); // 提交数据 - emit('submit', {title: data.title, price: data.price, num: data.num, priceTxt: data.price.toFixed(2)}, props.index); + emit('submit', {title: data.title, price: data.price, num: (data.num < 0 ? 1 : data.num), priceTxt: data.price.toFixed(2)}, props.index); } diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 942a805..cfc130a 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -68,8 +68,8 @@ import { watch } from 'vue'; // 当前index const index = ref(""); - // 商品信息 - const goodItem = reactive({title: '', price: 0, num: 0, priceTxt: '0.00'}); + // 商品信息, 此处给num -1 是为了默认为 + const goodItem = reactive({title: '', price: 0, num: -1, priceTxt: '0.00'}); // 总价 const sum = computed(() => cartStore.sum.toFixed(2)); @@ -161,7 +161,7 @@ import { watch } from 'vue'; // 重置数据 goodItem.title = ''; goodItem.price = 0; - goodItem.num = 0; + goodItem.num = -1; goodItem.priceTxt = '' }