处理待办事项
This commit is contained in:
65
pages/todo/todoAdd.vue
Normal file
65
pages/todo/todoAdd.vue
Normal file
@@ -0,0 +1,65 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user