首页 > 其他分享 >VUE-小黑笔记本

VUE-小黑笔记本

时间:2024-03-21 18:03:57浏览次数:14  
标签:VUE color items 笔记本 10px font border 小黑 left

一、效果

二、功能介绍

1.输入框输入任务,按下回车键,添加任务至任务栏最后

2.鼠标移动到某项任务,后面出现叉号,即可删除任务

3.记事本最下方左边统计当前任务总数

4.记事本最下方右边clear实现清空任务 同时最底部一栏隐藏

三、代码(含样式)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>1</title>
    <link rel="stylesheet" href="./bootstrap/css/bootstrap.min.css">
    <script src="./bootstrap/js/jquery.js"></script>
    <script src="./bootstrap/js/popper.min.js"></script>
    <script src="./bootstrap/js/bootstrap.min.js"></script>
    <style>
        *{
            padding-left: 0;
            margin:0;
            list-style: none;
        }
        body{
            background-color: #eee;
        }
        header,footer{
            text-align: center;
            height: 60px;
          
        }
        h2{
            color:rgba(238, 7, 7, 0.842);
            font-weight: 400;
            line-height: 60px;
        }

        section{
            width:90%;
            margin:0 auto;
            background-color: #fff;
            box-shadow:  5px 5px 3px #ccc;
            border-radius: 0 0 3% 3%;
        }
        .title{
            border-bottom: 1px solid #ccc;
        }
        input{
            width:100%;
            border:none;
            height: 40px;
            padding:5px 20px;
            box-sizing: border-box;
            font-size: 20px;
            color:#333;            
        }
        .items{
            width:100%;
        }
        .items ul{
            width:100%;
        }
        li{
            width:100%;
            box-sizing: border-box;
            padding-left: 0;
            padding:10px 10px;
            border-bottom: 1px solid #ccc;
            color:#666;
            position: relative;
        }
        .order{
            padding: 0 10px;
        }
        .delete{
            position: absolute;
            right:10px;
            top:10px;
            display: none;
			font-size: 24px;
            cursor: pointer;   /*鼠标删除小手*/
        }
        .items li:hover .delete{
            display: block;
        }
        .tongji{
            overflow: hidden;
            height: 40px;
            line-height: 40px;
            font-size: 14px;
            color:darkturquoise;
        }
        .left{
            float: left;
            margin-left: 20px;
            font-style: italic;
        }
        .left span{
            margin-right: 10px;
           
        }
        .clear{
            float: right;
            margin-right: 20px;
            cursor: pointer;   /*鼠标删除小手*/
        }
    </style>
</head>
<body>
    <header>
        <h2>小黑记事本</h2>
    </header>
    <section id="app">
        <div class="title">           
            <input type="text" placeholder="请输入待做事项" v-model.trim="msg" @keyup.enter="add" autocomplete="off">
        </div>
        <div class="items">
            <ul type="1">
                <li v-for="(item,index) in items">
                    <span class="order">{{index+1}}.</span>{{item}} <span class="delete" @click="remove(index)">x</span>
                </li>                
            </ul>
        </div>
        <div class="tongji" v-show="items.length!=0">
            <div class="left"><span>{{items.length}}</span>items left</div>
            <div class="clear"><span @click="clear">Clear</span></div>
        </div>
    </section>
    <script src="./js/vue.js"></script>
    <script>
        var app=new Vue({
            el:"#app",
            data:{
                msg:"",
                items:["web应用开发","UI动效设计","手机微电影制作"]
            },
            methods:{
                add:function(){   
                    if(this.msg!="")                
                    {
                        this.items.push(this.msg);
                        this.msg="";
                    }
                },
                remove:function(index){
                    // console.log("删除");
                    // console.log(index);
                    this.items.splice(index,1);
                },
                clear:function(){
                    this.items=[];
                }
            }
        });
    </script>
</body>
</html>

标签:VUE,color,items,笔记本,10px,font,border,小黑,left
From: https://blog.csdn.net/m0_74346476/article/details/136915799

相关文章

  • vue3使用qrcodejs2-fix生成背景透明的二维码
    qrcodejs官方仓库:GitHub-davidshimjs/qrcodejs:Cross-browserQRCodegeneratorforjavascriptqrcodejs2-fix 是一个用于生成QR码的JavaScript库,使用的时候先安装,然后通过设置前景色和背景色可以控制显示的二维码效果。想生成透明背景的二维码也可以,我通过下面配置前景......
  • VUE3学习笔记
    参考链接https://blog.csdn.net/m0_66100833/article/details/134294781生命周期setup():这是一个新的入口点,在beforeCreate和created之前调用onBeforeMount/onMounted:组件挂载前/后的生命周期钩子。onBeforeUpdate/onUpdated:组件更新前/后的生命周期钩子。onBeforeUnmount/onU......
  • 前端学习-vue学习011-Emit
    官方教程链接子组件还可以向父组件触发事件子组件声明触发的事件,并且带参数触发<scriptlang="ts"setup>constemit=defineEmits(['res'])emit('res','hithisismymsg')//第一个参数是事件名称,其他参数都会传给父组件</script>父组件接收参数<template>......
  • vue2/3 - element表格组件el-table实现懒加载树型(上下级)数据、默认展开和隐藏层级,支
    效果图在vue2、vue3项目开发中,使用element饿了么组件库,实现Table表格组件动态懒加载表格数据,可以决定是否自动展开所有2级或3级,也可以点击加载下级数据,可搭配表格的增删改查,数据变化后自动更新列表不会破坏树状的展开和折叠结构。提供详细示例代码,一键复制运行查看效果,稍......
  • vue2/3 - element组件库el-tree树形控件实现一键全选/一键反选取消/全部收起/全部折叠
    效果图在vue2、vue3|element饿了么组件库中,详细使用el-tree树状组件完成功能按钮组,支持全部选中节点、反选取消节点、对所有树节点进行折叠收起、是否上下级联动等等!提供详细示例代码教程,一键复制开箱即用~~示例代码请看下方代码及技术点介绍。<template><div......
  • Angular React Vue 比较 – 模板篇
    如果我们把组件篇比做是前端的JavaScript,那么模板篇则是HTML。三大框架中的模板在应用中呈现用户界面,就像常规HTML一样,但是它具有更多功能。Angular的模板在Angular中,*template* 是HTML的一个块。在模板中我们可以使用Angular的语法来构建更多的功能。编写......
  • vue2 txt日志打印以及读取txt文本数据
    1.创建log.js在根目录下letfs=require('fs')import{parseTime}from"./src/renderer/utils/index"import{MessageBox}from'element-ui'functionwriteLog(value){letlogAddress=localStorage.getItem('logAddress')......
  • 前端学习-vue学习009-侦听器
    官方教程链接侦听器:import{ref,watch}from'vue'constcount=ref(0)watch(count,(newCount)=>{console.log(`newcountis:${newCount}`)})pre标签:识别json对象中的\n\t等转义字符,展示原始的JSON对象结构。v-ifv-elseasyncawaitfetch<template>......
  • vue2扫码枪串口模式的使用
    1.下载依赖包  serialportnpmiserialport2.创建文件code-gun.jsvar{SerialPort}=require("serialport");//串口列表SerialPort.list().then((ports)=>{ports.forEach((port)=>{console.log(port);});}).catch((err)=&......
  • Node+Vue毕设社区居家养老管理系统(程序+mysql+Express)
    本系统(程序+源码)带文档lw万字以上 文末可获取本课题的源码和程序系统程序文件列表系统的选题背景和意义选题背景:在人口老龄化日益加剧的今天,社区居家养老已成为解决老年人养老问题的重要方式。随着社会经济的发展和科技的进步,老年人对于养老服务的需求不再局限于基本的......