Files
cmgd-mini-app/pages/todo/todoAdd.vue
2026-01-15 18:00:15 +08:00

65 lines
1.1 KiB
Vue

<template>
<view class="page-content">
<view style=" padding: 20rpx;">
<nut-form>
<nut-form-item label="待办事项">
<nut-textarea v-model="form.content" :rows="3" placeholder="请输入待办事项" type="text" />
</nut-form-item>
<view style="align-items: center;text-align: center; padding: 20rpx 60rpx;">
<nut-button type="primary" block @click="onSubmit">
新增待办事项
</nut-button>
</view>
</nut-form>
</view>
</view>
</template>
<script setup>
import {
onMounted,
reactive,
ref,
toValue
} from 'vue';
import {
fetchAddTodo,
} from '@/api/index';
const form = reactive({
content: '',
})
const onSubmit = () => {
console.log('form====>', form);
fetchAddTodo(form).then(res => {
uni.showToast({
icon: 'none',
title: '新增待办事项成功'
})
setTimeout(() => {
uni.switchTab({
url: '/pages/todo/todoList'
});
}, 500)
})
}
</script>
<style lang="scss" scoped>
.page-content {
min-height: 100vh;
background-color: #f2f3f5;
}
</style>