Vue便签的简单实现
作者:快乐江小鱼 发布时间:2024-05-02 17:03:31
标签:Vue,便签
html部分
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>小钱便签</title>
<!-- 引入自定义样式表 -->
<link rel="stylesheet" type="text/css" href="index.css" rel="external nofollow" />
</head>
<body>
<!-- 主体区域 -->
<section id="app">
<!-- 输入框 -->
<header>
<h1 class="title">便签</h1>
<input type="text" v-model="inputValue" autofocus="autofocus"
placeholder="请输入事项" autocomplete="off" class="new-todo"
@keyup.enter="add"/>
</header>
<!-- 列表区域 -->
<section class="main">
<ul class="todo-list">
<li class="todo" v-for="(item, index) in list">
<div class="view">
<span class="index">{{ index + 1 }}</span>
<label>{{ item }}</label>
<button class="destroy" @click="remove(index)">删除</button>
</div>
</li>
</ul>
</section>
<!-- 统计和清空 -->
<footer class="footer">
<span class="todo-count" v-if="list.length != 0">{{ list.length }}<strong></strong>@nbsp;items left</span>
<button @click="clear" v-show="list.length != 0">Clear</button>
</footer>
</section>
<!-- 底部 -->
<footer class="info">
<p>
<a href="https://www.baidu.com/" rel="external nofollow" ><img src="https://www.baidu.com/img/flexible/logo/pc/result.png"/></a>
</p>
</footer>
<!-- 开发环境版本 -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
var app = new Vue({
el: '#app',
data: {
list: ["糖醋里脊", "红烧狮子头", "蒸鸡蛋"],
// 初始化输入值为空
inputValue: ""
},
methods: {
add: function() {
this.list.push(this.inputValue);
},
remove: function(index) {
this.list.splice(index, 1);
},
clear: function() {
this.list = []
}
}
})
</script>
</body>
</html>
css样式表
* {
padding: 0;
margin: 0;
}
#app {
width: 300px;
/* 盒子居中对齐 */
margin: 5px auto;
box-shadow: 0px 3px 10x 2px rgba(0, 0, 0, 0.1);
}
.title {
font: normal 200 34px '微软雅黑';
color: rgb(219, 82, 82);
text-align: center;
padding-top: 100px;
padding-bottom: 10px;
}
.new-todo {
width: 100%;
height: 40px;
padding-left: 10px;
color: rgb(88, 88, 88);
box-sizing: border-box;
border: 1px solid rgb(236, 236, 236);
}
.new-todo:focus {
outline: none;
}
.footer {
position: relative;
width: 100%;
height: 40px;
box-sizing: border-box;
border: 1px solid rgb(236, 236, 236);
background-color: white;
}
.footer span {
font-size: 12px;
color: rgb(131, 131, 131);
float: left;
line-height: 40px;
}
.todo-count {
margin-left: 10px;
}
.clear-button {
margin-left: 170px;
}
.todo {
list-style: none;
font-size: 14px;
font-family: '微软雅黑';
color: rgb(88, 88, 88);
box-sizing: border-box;
width: 100%;
height: 40px;
line-height: 40px;
border: 1px solid rgb(236, 236, 236);
background-color: white;
}
.view {
position: relative;
margin-left: 10px;
}
.view label {
width: 200px;
height: 40px;
position: absolute;
/* 超出的文本隐藏 */
overflow: hidden;
/* 溢出用省略号表示 */
text-overflow: ellipsis;
/* 溢出不换行 */
white-space: nowrap;
}
.destroy {
position: absolute;
right: 10px;
top: 9px;
font-size: 12px;
font-family: '微软雅黑';
outline: none;
border: 1px solid rgb(236, 236, 236);
color: rgb(255, 111, 111);
display: none;
}
.view:hover .destroy {
display: block;
}
.footer button {
position: absolute;
right: 10px;
top: 9px;
font-size: 12px;
font-family: '微软雅黑';
outline: none;
border: 0px;
color: rgb(131, 131, 131);
}
.info {
margin: 5px auto;
width: 300px;
}
.info a {
padding-left: 50px;
}
来源:https://blog.csdn.net/dolly_baby/article/details/130190051


猜你喜欢
- 交互设计师主导或发起的项目很难拿到结果——现状这个问题在很多的小公司都不存在。小公司养着、催着设计师,设计师不用去考虑能不能拿到结果,因为你
- 使用itertools工具类中的chain方法,可以很方便的将多个iterable对象一起遍历. 不过,对于dict类型的iterable对
- 一、安装selenium库问题1:什么是selenium模块?基于浏览器自动化的一个模块。 问题2:selenium模块有什么作用
- python开发中经常遇到报错的情况,但是warning通常并不影响程序的运行,而且有时特别讨厌,下面我们来说下如何忽略warning错误。
- 这篇文章主要介绍了python读取ini配置文件过程示范,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的
- 我想大多数的人在编写ASP程序的时候,都碰到过类似的错误信息: Error Number -> 
- 一、定义正则表达式是对字符串操作的一种逻辑公式,就是用事先定义好的一些特定字符、及这些特定字符的组合,组成一个“规则字符串”,这个“规则字符
- 在Python中一切都是对象。Python中对象包含的三个基本要素,分别是:id(身份标识)、type(数据类型)和value(值)。对象之
- 一个用asp来处理jmail发信的过程,及使用方法. 发信时,直接调用这个过程就行了,很方便。<% dim
- 我就废话不多说了,直接上代码吧!#!/usr/bin/env python# coding:UTF-8"""@
- 一、前言在生活中,我们经常会遇到电脑中文件重复的情况。在文件较少的情况下,这类情况还比较容易处理,最不济就是一个个手动对比删除;而在重复文件
- 一、CSS HACK以下两种方法几乎能解决现今所有HACK.1, !important随着IE7对!important的支持, !impor
- 今天拉了一个使用了tornado的项目在本地跑,按照源码作者的步骤配置完,运行,直接报错了,要求环境Python3.6+,我装的是Pytho
- 首先说一下我遇到的坑,生产上遇到的问题,我调度Python脚本执行并监控这个进程,python脚本运行时间远远大于python脚本中自己统计
- 一、argparse介绍官方文档argparse 模块是 Python 内置的一个用于命令项选项与参数解析的模块,argparse 模块可以
- 求字符串中最大的递增子序列数据库环境:SQL SERVER 2005如题,求字符串“abcbklmnodfghijkmer”中最大的递增子序
- Python最大的优点之一就是语法简洁,好的代码就像伪代码一样,干净、整洁、一目了然。要写出 Pythonic(优雅的、地道的、整洁的)代码
- Python下有许多款不同的 Web 框架。Django是重量级选手中最有代表性的一位。许多成功的网站和APP都基于Django。Djang
- 在安装tensorflow完成后,import tensorflow as tf出现问题,问题如下:>>> import
- 前言:前几天上课闲着没事写了一个python敲击木鱼积累功德的小项目,当时纯粹就是写着玩,回顾一下鼠标事件的东西还记不记得,发现这个博客的点