完善页面8
This commit is contained in:
@@ -125,13 +125,19 @@ const formData = reactive({
|
||||
const showCouponModal = ref(false)
|
||||
const isEditing = ref(false)
|
||||
const editingIndex = ref(-1)
|
||||
const editingCoupon = reactive<Coupon>({ id: 0, name: '', desc: '' })
|
||||
|
||||
const couponOptions = reactive<Coupon[]>([
|
||||
// 使用 reactive 并显式指定初始对象,后续通过类型断言或接口约束保证类型安全
|
||||
const editingCoupon = reactive({
|
||||
id: 0,
|
||||
name: '',
|
||||
desc: ''
|
||||
}) as Coupon
|
||||
|
||||
const couponOptions = reactive([
|
||||
{ id: 1, name: '满100减10元券', desc: '全场通用' },
|
||||
{ id: 2, name: '新人5元无门槛', desc: '仅限新人使用' },
|
||||
{ id: 3, name: '满200减50元券', desc: '限特定商品' }
|
||||
])
|
||||
] as Coupon[])
|
||||
|
||||
function isSelected(item: Coupon): boolean {
|
||||
return formData.coupons.some(c => c.id === item.id)
|
||||
|
||||
Reference in New Issue
Block a user