本教程将带您在1小时内完成一个完整的Todo应用,覆盖页面设计、API调用和组件开发。最终效果包含任务管理、状态切换和本地存储功能。
一、项目结构
pages/
index/
index.vue # 主页面
components/
todo-item.vue # 自定义任务组件
static/
icons/ # 图标资源
二、核心功能实现
1. 页面布局 (pages/index/index.vue)
<template>
<view class="container">
<!-- 标题区 -->
<view class="header">
<text class="title">今日任务</text>
<text class="count">已完成: $completedCount$/$totalCount$</text>
</view>
<!-- 输入框 -->
<view class="input-area">
<input
v-model="newTask"
placeholder="添加新任务..."
@confirm="addTask"
/>
<button @click="addTask">添加</button>
</view>
<!-- 任务列表 -->
<scroll-view scroll-y class="list-container">
<todo-item

最低0.47元/天 解锁文章
795

被折叠的 条评论
为什么被折叠?



