当前位置: 首页 > news >正文

vue记事本渲染以及交互

以下是记事本的源码

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>记事本</title><style>
/* 标题 */
h1{margin-top: 130px;color: red;font-size: 29px;
}/* 按钮 */
button {/* 去掉黑圈 */margin: 0;padding: 0;border: 0;background: none;
}
/* 主体 */
body {line-height: 1.4em;background: #f5f5f5;color: #4d4d4d;min-width: 260px;max-width: 600px;margin: 0 auto;font-weight: 300;
}
/* 输入框 */
.new-todo{position: relative;margin: 0;width: 100%;font-size: 24px;
}
/* 列表渲染 */
.todo-list li {position: relative;font-size: 24px;height: 60px;box-sizing: border-box;border-bottom: 1px solid #e6e6e6;
}
/* 列表渲染 */
.todo-list li {word-break: break-all;padding: 15px 15px 15px 60px;display: block;line-height: 1.2;transition: color 0.4s;
}
/* 删除按键 */
.todo-list li .destroy {display: none;position: absolute;top: 0;right: 10px;bottom: 0;width: 10px;height: 10px;font-size: 30px;color: black;margin-bottom: 11px;
}
/* 删除按键 */
.todo-list li .destroy:after {content: 'x';
}
/* 显示删除 */
.todo-list li:hover .destroy {display: block;
}
/* 删除 */
.clear-completed {float: right;position: relative;line-height: 20px;text-decoration: none;cursor: pointer;
}</style>
</head>
<body><!-- 容器 -->
<section id="todoapp" boder="1"><!-- 头部输入框 --><header class="header"><h1>小黑记事本</h1><input v-model="inputValue" v-on:keyup.enter="add" autofocus="autofocus" autocomplete="off" placeholder="请输入任务"class="new-todo" /></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 @click="remove(index)" class="destroy"></button></div></li></ul>
</section><!-- 统计和清空 --><footer class="footer"><!-- <span v-if="list.length" class="todo-count"><strong>{{ list.length }}</strong></span> --><button v-show="list.length" v-on:click="clear" class="clear-completed">全删</button></footer>
</section></body>
<script src="D:\technology\Technology\vue.js\vue.js"></script>
<script>
// 创建 Vue 实例
let vm = new Vue({el:"#todoapp",data:{list: ["俯卧撑", "跑步", "游泳"],},methods:{     add:function(){let data = this.inputValue.trim()if (data != "")this.list.push(this.inputValue);elseconsole.log("null");},remove: function (index){console.log("remove", index);this.list.splice(index, 1);},// +clear: function (){this.list = [];}}
})</script></html>
http://www.lryc.cn/news/329965.html

相关文章:

  • Zookeeper中的脑裂
  • 【漏洞复现】金和OA XmlDeal.aspx XXE漏洞
  • 对比:React 还是 Vue
  • ubuntu 20.04 SD 卡分区类型 msdos 改为 GPT 的方法
  • Kubernetes(K8s)技术解析
  • Python 基于 OpenCV 视觉图像处理实战 之 OpenCV 简单实战案例 之十 简单颜色反转效果
  • 【ELK+Kafka+filebeat分布式日志收集】部署filebeat和Kibana(三)
  • 二.音视频编辑-媒体组合-播放
  • 前端安全-面试题(2024)
  • CVE-2022-29405 Apache Archiva任意用户密码重置漏洞分析
  • ssm框架配置文件例子
  • maven构建项目报错:Failure to find com.microsoft.sqlserver:sqljdbc4:jar:4.0 in
  • 已解决rabbitmq AMQPConnectionClosedException:管道破裂或连接关闭异常的正确解决方法,亲测有效!!!
  • Excel 隔几行批量插入空白行
  • 2024年04月在线IDE流行度最新排名
  • 如何通过Elasticsearch实现搜索的关键词达到高亮的效果
  • 真实sql注入以及小xss--BurpSuite联动sqlmap篇
  • Java类和对象练习题
  • Qt 实现简易的视频播放器,功能选择视频,播放,暂停,前进,后退,进度条拖拉,视频时长显示
  • vue基础教程(6)——构建项目级登录页
  • C++宝强越狱1.0.6版本
  • 构建高可用性数据库架构:深入探索Oracle Active Data Guard(ADG)
  • 记录-rosbag的处理
  • 用Wireshark解码H.264
  • Flink中几个关键问题总结
  • 华为配置ARP安全综合功能实验
  • new mars3d.layer.XyzLayer({的rectangle瓦片数据的矩形区域范围说明
  • 数据分析之Tebleau可视化:折线图、饼图、环形图
  • 【Frida】【Android】 07_爬虫之网络通信库HttpURLConnection
  • 算法2.6基数排序