vue+bootstrap简易响应式任务管理表:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,user-scalable=no"/>
<link rel="stylesheet" type="text/css" href="bs/css/bootstrap.css"/>
<script src="bs/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="bs/js/bootstrap.js" type="text/javascript" charset="utf-8"></script>
<script src="vue.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
window.onload = function(){
var vm = new Vue({
el:".container",
data:{
datalist:[],
username:'',
age:'',
nowindex:-1
},
methods:{
add:function(){
if(this.username.trim()!=''&& this.age.trim()!=''){
this.datalist.push({
name:this.username,
age:this.age
});
} this.username='',
this.age=''
}, res:function(){
this.username='',
this.age=''
}, del:function(num){
if(num==-2){
this.datalist = [];
}else{
this.datalist.splice(num,1);
}
}
} })
}
</script>
</head>
<body>
<div class="container">
<form>
<form class="form-group">
<label for="username">任务</label>
<input type="text" name="username" id="username" class="form-control" placeholder="请输入事件" v-model="username"/>
</form>
<br />
<form class="form-group">
<label for="age">时间</label>
<input type="text" name="age" id="age" class="form-control" placeholder="请输入时间" v-model="age"/>
</form>
<div class="form-group">
<input @click="add()" type="button" class="btn btn-primary" value="添加"/>
<input @click="res()" type="reset" class="btn btn-danger" value="重置" />
</div>
</form>
<table class="table table-bordered table-hover">
<caption class="h3 text-info">to do list</caption>
<tr class="text-center">
<th>序号</th>
<th>任务</th>
<th>时间</th>
<th>选项</th>
</tr>
<tr class="text-center" v-for="value in datalist">
<td>{{$index+1}}</td>
<td>{{value.name}}</td>
<td>{{value.age}}</td>
<td>
<input data-toggle="modal" data-target="#sure" type="button" class="btn btn-primary btn-sm" value="删除" @click="nowindex=$index"/>
</td>
</tr>
<tr v-show="datalist.length!=0">
<td class="text-right" colspan="4">
<input data-toggle="modal" data-target="#yes" type="button" class="btn btn-primary btn-sm" value="删除全部" @click="nowindex=-2"/>
</td>
</tr> <tr v-show="datalist.length==0">
<td colspan="4" class="text-center">
<p>暂无任务</p>
</td>
</tr>
</table>
<!--模态框-->
<div class="modal fade" id="sure">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span>&times;</span>
</button>
<h3>你确定要删除吗</h3>
</div>
<div class="modal-body text-right">
<input type="button" data-dismiss="modal" class="btn btn-info btn-sm" value="取消"/>
<input type="button" data-dismiss="modal" class="btn btn-primary btn-sm" value="确定" @click="del(nowindex)"/>
</div>
</div>
</div>
</div> <div class="modal fade" id="yes">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span>&times;</span>
</button>
<h3>确定清空吗</h3>
</div>
<div class="modal-body text-right">
<input type="button" data-dismiss="modal" class="btn btn-info btn-sm" value="取消"/>
<input type="button" data-dismiss="modal" class="btn btn-primary btn-sm" value="确定" @click="del(nowindex)"/>
</div>
</div>
</div>
</div> </div>
</body> </html>

vue 简易toDoList的更多相关文章

  1. vue demo todo-list

    html <input type='text' v-model="todoItem" v-on:keyup.enter='addItem'> <ul> &l ...

  2. vue 实现todolist,包含添加,删除,统计,清空,隐藏功能

    vue 实现todolist,包含添加,删除,统计,清空,隐藏功能 添加:生成列表结构(v-for+数组).获取用户输入(v-model).通过回车新增数据(v-on+.enter) 删除:点击删除指 ...

  3. vue案例todolist备忘录

    项目效果:https://cinderellastory.github.io/todolist/dist/index.html#/ 项目链接:https://github.com/Cinderella ...

  4. Vuejs 实现简易 todoList 功能 与 组件

    todoList 结合之前 Vuejs 基础与语法 使用 v-model 双向绑定 input 输入内容与数据 data 使用 @click 和 methods 关联事件 使用 v-for 进行数据循 ...

  5. Vue完成TodoList案例

    写一个简单的TodoList的更实用(文末有彩蛋). 一,使用VUE-CLI脚手架快速搭建一个框架 利用VUE-CLI来自动生成我们项目的前端目录及文件,方法: npm install -g vue- ...

  6. 用vue做todolist

    <template> <div class="hello"> <div style="height:25px;line-height:25p ...

  7. Vuex + localStorage + html实现简易todolist

    1.项目结构 2.Vuex,什么是Vuex? 官方文档上的介绍是:Vuex 是一个专为 Vue.js 应用程序开发的状态管理模式.它采用集中式存储管理应用的所有组件的状态,并以相应的规则保证状态以一种 ...

  8. 基于Vue简易封装的快速构建Echarts组件 -- fx67llQuickEcharts

    fx67llQuickEcharts A tool to help you use Echarts quickly! npm 组件说明 这本来是一个测试如何发布Vue组件至npm库的测试项目 做完之后 ...

  9. vue - Vue脚手架/TodoList案例

    今天做了一个案例,可以好好做做能够将之前的内容结合起来,最主要的是能对组件化编码流程有一个大概的清晰认知,这一套做下来,明天自己再做一遍复习一下,其实组件化流程倒是基本上没什么问题了,主要是很多vue ...

随机推荐

  1. Excel自动从身份证中提取生日、性别、年龄

    现在学生的身份证号已经全部都是18位的新一代身份证了,里面的数字都是有规律的.前6位数字是户籍所在地的代码,7-14位就是出生日期.第17位“2”代表的是性别,偶数为女性,奇数为男性.我们要做的就是把 ...

  2. 记录一下CSS outline-width 属性

    outline(轮廓)是绘制于元素周围的一条线,位于边框边缘的外围. outline-width指定轮廓的宽度. 注意: 请始终在outline-width属性之前声明outline-style属性. ...

  3. 学习笔记(七): Logistic Regression

    目录 Calculating a Probability Model Training 1.Loss function for Logistic Regression 2.Regularization ...

  4. django+xadmin在线教育平台(六)

    4-1 使用py3.6和django1.11开发系统前注意事项 直接通过Python3.6和django最新版本来开发我们的系统的一些注意事项. 原版本: Python 2.7 & djang ...

  5. phpstudy iis版本 php4.4.5 和 php5.6.7目录权限问题

    开始用的php4.4.5  +iis 权限设置好了,切换成php5.6.7后目录没有了写入权限,各种百度后未能解决 php4.4.5  +iis  时 iis 匿名身份验证 用户是 IUSR    目 ...

  6. tp5 修改自带success或error跳转模板页面

    tp5 修改自带success或error跳转模板页面 我们在使用tp5或者tp3.2的时候,用的成功或者失败跳转提示页面一般是用框架的.在后续开发过程中,根据实际项目需要,也是可以更改的,在此分享一 ...

  7. ZendFramework-2.4 源代码 - 路由(类图)

    <?php return array( // console 模式 'console'=>array( 'router' => array( //.... ), ), // http ...

  8. 转 Laravel 的核心 —— 服务容器

    具体内容请参考 1.laravel 学习笔记 —— 神奇的服务容器 - 灵感 - 来自生活的馈赠https://www.insp.top/article/learn-laravel-container ...

  9. IOS开发---菜鸟学习之路--(十二)-利用ASIHTTPRequest进行异步获取数据

    想要实现异步获取的话我这边了解过来有两个非常简单的方式 一个是利用ASIHTTPRequest来实现异步获取数据 另一个则是利用MBProgressHUD来实现异步获取数据 本章就先来讲解如何利用AS ...

  10. jeakins配置邮件通知,附带解决535报错:authentication failed,如果发现测试邮件可以发出,项目构成无法发出邮件,请开启SSL认证,端口号改为(465),qq邮箱、163邮箱通用

    535报错解决方案:调用163邮箱服务器来发送邮件,我们需要开启POP3/SMTP服务,这时163邮件会让我们设置客户端授权码,这个授权码替代上面代码部分的passwd即可成功发送邮件 如果设置的邮箱 ...