+ v-model="str"
+ class="todo-input"
+ type="text"
+ placeholder="Add a todo">
- add todo
-
+ @click="add"
+ class="todo-button">
+ add todo
+
+
+
-
-
-
-
{{item.text}}
+
暂无待办事项,请添加新任务
+
+
+
+
+ {{ item.text }}
+
+
del
-
del
@@ -86,6 +96,17 @@ const list = ref([{
/* 将元素置于页面其他元素的下方,避免遮挡其他内容 */
}
.todo-app {
+ width: 98%;
+ min-height: 500px; /*或 height: auto */
+ background-color: #FFFFFF;
+ border-radius: 5px;
+ margin-top: 40px;
+ margin-left: 1%;
+ padding-top: 30px;
+ padding-bottom: 10px;
+ box-sizing: border - box;
+}
+/* .todo-app {
width: 98%;
height: 500px;
background-color: #FFFFFF;
@@ -93,8 +114,11 @@ const list = ref([{
margin-top: 40px;
margin-left: 1%;
padding-top: 30px;
+ padding-bottom: 10px;
box-sizing: border-box;
- }
+ overflow-y: auto;
+ /* 启用垂直滚动条
+} */
body{
background : linear-gradient(
to right,
@@ -136,6 +160,31 @@ const list = ref([{
justify-content: space-between;
margin-bottom: 5px;
}
+ .no-todo-tip {
+ text-align: center; /* 文字水平居中 */
+ font-size: 16px; /* 调整字体大小 */
+ color: #333; /* 深灰色,醒目且不刺激 */
+ margin-top: 20px; /* 与上方元素保持一定间距 */
+ font-weight: 500; /* 增加字体粗细 */
+ padding: 20px; /* 添加内边距,使提示区域更明显 */
+ background-color: #f5f5f5; /* 浅灰色背景,增强可见性 */
+ border-radius: 8px; /* 圆角边框 */
+ font-weight: 800; /* 半粗体,使文字更突出 */
+}
+/* 添加错误提示样式 */
+.error-message {
+ color: #ff4d4f; /* 柔和的红色 */
+ text-align: center;
+ margin: 10px 0; /* 上下间距 */
+ font-size: 14px;
+ padding: 10px 15px; /* 适当内边距 */
+ background-color: #fff2f0; /* 浅红色背景 */
+ border-radius: 6px;
+ transition: all 0.25s ease;
+ max-width: 400px; /* 限制最大宽度 */
+ margin-left: auto; /* 配合max-width实现居中 */
+ margin-right: auto;
+}
.todo-button{
user-select: none;
cursor: pointer;