您的位置:首页 > Web前端 > Vue.js

vue实现简单的ToDoList

2018-09-20 15:13 309 查看

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0" />
<script src="vue.js"></script>
<link rel="stylesheet" type="text/css" href="font-awesome-4.7.0\css\font-awesome.css">
<script type="text/javascript" src="jquery-3.2.1.js"></script>
<link rel="stylesheet" type="text/css" href="bootstrap-3.3.7-dist\css\bootstrap.css">

<style type="text/css">
*{
    margin: 0;
    padding: 0;
}
header{
    background-color: black;
}
header h3{
    color: white;
    margin: 0;
    padding: 0;
    line-height: 54px;
}
.info{
    line-height: 54px;
}
.info input{
    display: inline-block;
}
main h3{
    color: black;
    margin: 0;
    padding: 0;
    line-height: 50px;
}
span{
    color: black;
    line-height: 50px;
    float: right;
}
</style>

<body>
<div id="app">
    <header class="col-md-12 col-xs-12">
        <div class="col-md-3 col-xs-0"></div>
        <div class="col-md-3 col-xs-4 title">
            <h3>ToDoList</h3>
        </div>
        <div class="col-md-3 col-xs-8 info">
            <input type="text" class="form-control addinput" v-on:keyup.enter="submit">
        </div>
        <div class="col-md-3 col-xs-0"></div>
    </header>
    <main>
        <div class="col-md-3 col-xs-0"></div>
        <div class="col-md-6 col-xs-12">
            <h3 class="col-md-11 col-xs-10"><strong>正在进行</strong></h3><span class="col-md-1 col-xs-2">{{todoList.length}}</span>
                <table class="table">
                    <tr v-for="(l,index) in todoList">
                        <td class="col-xs-1"><i class="fa fa-square-o" v-on:click="changeList(l,index)"></i></td>
                        <td class="col-xs-10">{{l.name}}</td>
                        <td class="col-xs-1"><i class="fa fa-close" v-on:click="deletetodo(index)"></i></td>
                    </tr>
                </table>
            <h3 class="col-md-11 col-xs-10"><strong>已经完成</strong></h3><span class="col-md-1 col-xs-2">{{doneList.length}}</span>
                <table class="table">
                    <tr v-for="l in doneList">
                        <td class="col-xs-1"><i class="fa fa-check-square-o"></i></td>
                        <td class="col-xs-10">{{l.name}}</td>
                        <td class="col-xs-1"><i class="fa fa-close" v-on:click="deletedone(index)"></i></td>
                    </tr>
                </table>
        </div>
        <div class="col-md-3 col-xs-0"></div>
    </main>
</div>
</body>
</html>

阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: