Skip to content

Commit

Permalink
update to 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
xa1st committed Dec 4, 2023
1 parent 49b2ea7 commit 3e8e20d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/inputBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<input type="text" class="input radius text-center" placeholder="请输入商品的名称,必填" :value.trim="good.title" @blur="editTit"/>
<input type="number" class="input radius text-center" placeholder="请输入商品的价格,单位:元,默认0.00" :value.number="good.price == 0 ? '' : good.price.toFixed(2)" @blur="editPrice"/>
<input type="number" class="input radius text-center" placeholder="请输入商品的数量,默认为1" :value.number="good.num == 0 ? '' : good.num " @blur="editNum"/>
<input type="number" class="input radius text-center" placeholder="请输入商品的数量,默认为1" :value.number="good.num < 0 ? '' : good.num " @blur="editNum"/>
<div class="addbtn text-center radius" @click.stop="submit">我填好了啦 ^_^</div>
<div class="closebtn" @click.stop="close"><i class="iconfont cartclose"/></div>

Expand Down Expand Up @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ import { watch } from 'vue';
// 当前index
const index = ref<string>("");
// 商品信息
const goodItem = reactive<Good>({title: '', price: 0, num: 0, priceTxt: '0.00'});
// 商品信息, 此处给num -1 是为了默认为
const goodItem = reactive<Good>({title: '', price: 0, num: -1, priceTxt: '0.00'});
// 总价
const sum = computed<string>(() => cartStore.sum.toFixed(2));
Expand Down Expand Up @@ -161,7 +161,7 @@ import { watch } from 'vue';
// 重置数据
goodItem.title = '';
goodItem.price = 0;
goodItem.num = 0;
goodItem.num = -1;
goodItem.priceTxt = ''
}
Expand Down

0 comments on commit 3e8e20d

Please sign in to comment.