vue写的ToDoList
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ToDoList</title>
<link rel="stylesheet" href="dist/css/bootstrap.min.css">
<script src="vue.min.js"></script>
</head>
<body>
<div id="box" class="container">
<div class="row clearfix">
<div class="col-md-12 column">
<div class="form-group">
<label for="exampleInputEmail1">用户名</label><input type="text" class="
user form-control" id="exampleInputEmail1" />
</div>
<div class="form-group">
<label for="exampleInputPassword1">密码</label><input type="password" class="
psd form-control" id="exampleInputPassword1" />
</div>
<button style="width:300px;margin: 10px auto" @click="submit()" >Submit</button> </div> <div class="col-md-12 column">
<table class="table table-striped">
<thead>
<tr>
<th class="col-md-2">
编号
</th>
<th class="col-md-4">
姓名
</th>
<th class="col-md-4">
密码
</th>
<th class="col-md-2">
<button type="button" class="btn btn-default btn-primary">按钮</button>
</th>
</tr>
</thead>
<tbody>
<tr v-for="(m, index) in msg">
<!--官方文档声明:$index和$key被移除 -->
<td>
{{ index+1 }}
</td>
<td>
{{ m[0] }}
</td>
<td>
{{ m[1] }}
</td>
<td>
<button type="button" class="btn btn-default btn-primary" v-on:click="getIndex(index)">删除</button>
</td>
</tr> </tbody>
</table>
</div>
</div>
</div> <script>
var vm=new Vue({
el:"#box",
data:{
msg:[["user","123456"],["admin","123"]]
},
methods:{
getIndex: function(index){
vm.msg.splice(index,1);
},
submit:function(){
var arr=[]
var user=document.querySelector(".user").value;
var psd=document.querySelector(".psd").value;
arr.push(user);
arr.push(psd);
vm.msg.push(arr);
}
}
});
</script> </body>
</html>
纯属自娱,看客见谅。。。
vue写的ToDoList的更多相关文章
- 通过Vue实现的todolist
和接口对接的todolist因为有后台的存在,todolist获取的数据会一直存在不丢失(不管你如何刷新页面),思路如下: 首先得先搞到接口: 通过这个接口地址可以获取整段的数据,成功err为0. 于 ...
- Vue编写的todolist小例子
Vue编写的todolist小例子 本篇博客主要包含一个内容: 1.第一个内容:使用Vue编写todolist例子,包含的主要知识是v-model,v-for,el表达式,以及Vue中使用method ...
- vue写出放大镜的效果
用vue写出放大镜查看图片的效果. 安装 npm install vue2.0-zoom 引入 import imgZoom from 'vue2.0-zoom' 组件 components: { i ...
- 用ES6的class模仿Vue写一个双向绑定
原文地址:用ES6的class模仿Vue写一个双向绑定 点击在线尝试一下 最终效果如下: 构造器(constructor) 构造一个TinyVue对象,包含基本的el,data,methods cla ...
- 用vue写一个仿简书的轮播图
原文地址:用vue写一个仿简书的轮播图 先展示最终效果: Vue的理念是以数据驱动视图,所以拒绝通过改变元素的margin-top来实现滚动效果.写好css样式,只需改变每张图片的class即可实现轮 ...
- 使用Vue写一个九九乘法表
Vue.js是一套构建用户界面的渐进式框架.与其他重量级框架不同的是,Vue 采用自底向上增量开发的设计. 下面是在Vue 测试实例 - 菜鸟教程(runoob.com)使用Vue写的一个九九乘法表, ...
- Vue案例之todoLIst实现
使用Vue实现todolist案例,如有不对敬请大佬多多指教 功能: 1.增加功能:在新增版块里面的输入框内输入数据,点击后面的"添加"按钮,将输入的数据添加到列表中,默认是未完成 ...
- 用vue 写h5页面-摇一摇
vue配合其他ui框架除了开发一个完整的web项目外,也有不少的项目做一些h5的活动页面开发.你的页面现在需要模拟微信的摇一摇动作. 项目环境: vue-cli 完成的一个项目 准备插件(包):依赖的 ...
- 原创《开源一个用 vue 写的树层级组件 vue-ztree》
最近由于后台管理项目的需要,页面需要制作一个无限树的需求,我第一感就想到了插件 ztree,不过我觉得它太大了,还是自己动手丰衣足食吧. ztree 的 demo 地址:http://www.tree ...
随机推荐
- Luogu 3193 [HNOI2008]GT考试
BZOJ1009 妙! 推荐这篇题解: https://www.luogu.org/blog/Edgration/solution-p3193 考虑设计dp,设$f_{i, j}$表示长串匹配到i,短 ...
- Redis了解
1. 使用Redis有哪些好处? (1) 速度快,因为数据存在内存中,类似于HashMap,HashMap的优势就是查找和操作的时间复杂度都是O(1) (2) 支持丰富数据类型,支持string,li ...
- Entity Framework Code-First(17):Database Initialization Strategy
Database Initialization Strategies in Code-First: You already created a database after running your ...
- 远程桌面--------ms12-020 漏洞复现 (死亡蓝屏)
漏洞名:MS12-020(全称:Microsoft windows远程桌面协议RDP远程代码执行漏洞) 介绍:RDP协议是一个多通道的协议,让用户连上提供微软终端机服务的电脑. windows在处理某 ...
- 数据结构_just_sort
问题描述 给定两个序列 a b,序列 a 原先是一个单调递增的正数序列,但是由于某些原因,使得序列乱序了,并且一些数丢失了(用 0 表示).经过数据恢复后,找到了正数序列 b ,且序列 a 中 0 的 ...
- 使用Spring加载properties配置文件.md
背景 类似于datasource.properties之类的配置文件,最初通过Java的Properties类进行处理.这种方式有许多弊端,如每次都需要读取配置文件:若将Properties作为成员变 ...
- [转]ORA-12516, TNS:listener could not find available handler with matching protocol stack
转至:http://blog.csdn.net/MichaelSrc/article/details/6760247 1.查看当前连接进程数 SQL>select count(*) from v ...
- 【1】循序渐进学 Zabbix :初识与基础依赖环境搭建( LNMP )
写在前面的话 运维监控是一个很大的话题,在这一块个人接触的比较突出的服务主要有 Nagio 和 Zabbix 两款.而这几年跳过的公司中,Zabbix 一直都是首选且唯一选择,Nagios 没遇到. ...
- CentOS 6.7中安装python3.5
1.安装一些依赖的软件包 yum groupinstall "Development tools" yum install zlib-devel bzip2-devel opens ...
- 自定义非等高 Cell
1.自定义非等高 Cell介绍 1.1 代码自定义(frame) 新建一个继承自 UITableViewCell 的类. 重写 initWithStyle:reuseIdentifier: 方法. 添 ...