Files
EmailBill/Web/src/components/AddClassifyDialog.vue
SunCheng 32d5ed62d0
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 16s
Docker Build & Deploy / Deploy to Production (push) Successful in 6s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
fix
2026-02-20 14:57:19 +08:00

77 lines
1.5 KiB
Vue

<template>
<PopupContainerV2
v-model:show="show"
title="新增交易分类"
:height="'auto'"
>
<div style="padding: 16px">
<van-form ref="addFormRef">
<van-field
v-model="classifyName"
name="name"
label="分类名称"
placeholder="请输入分类名称"
:rules="[{ required: true, message: '请输入分类名称' }]"
/>
</van-form>
</div>
<template #footer>
<div style="display: flex; gap: 12px">
<van-button
plain
style="flex: 1"
@click="resetAddForm"
>
取消
</van-button>
<van-button
type="primary"
style="flex: 1"
@click="handleConfirm"
>
确认
</van-button>
</div>
</template>
</PopupContainerV2>
</template>
<script setup>
import { ref } from 'vue'
import { showToast } from 'vant'
import PopupContainerV2 from './PopupContainerV2.vue'
const emit = defineEmits(['confirm'])
const show = ref(false)
const classifyName = ref('')
// 打开弹窗
const open = () => {
classifyName.value = ''
show.value = true
}
// 确认
const handleConfirm = () => {
if (!classifyName.value.trim()) {
showToast('请输入分类名称')
return
}
emit('confirm', classifyName.value.trim())
show.value = false
classifyName.value = ''
}
// 重置表单
const resetAddForm = () => {
classifyName.value = ''
}
// 暴露方法给父组件
defineExpose({
open
})
</script>