用vue实现一个记事本的功能

<!DOCTYPE html>
<html>
    <head>
    <meta charset="utf-8">
        <title>日京的记事本</title>
        <script src="/statics/vue.js"></script>
    </head>
<body>
    <section id="todoapp">
        <header>
            <h1>日京的记事本</h1>
            <input v-model="inputValue" @keyup.enter="add" autofocus="autofocus" autocomplete="off" placeholder="输入">
        </header>
        <section>
            <ul>
                <li v-for="(item,index) in list">
                    <div>
                        <span>{
         
  {index+1}}</span>
                        <label for="">{
         
  {item}}</label>
                        <button @click="remove(index)">删除</button>
                    </div>
                </li>
            </ul>
        </section>
        <footer>
            <span v-show="list.length!=0">
                <strong>{
         
  {list.length}}</strong>item left
            </span>
            <button v-show="list.length!=0" @click="clear">清空</button>
        </footer>
    </section>
    <footer>

    </footer>
</body>
<script>
    var app=new Vue({
        el:"#todoapp",
        data:{
            list:["whj","hhh","xxx"],
            inputValue:"加油哦"
        },
        methods:{
            add:function(){
                this.list.push(this.inputValue)
            },
            remove:function(index){
                console.log("删除")
                console.log(index)
                this.list.splice(index,1)
            },
            clear:function(){
                this.list=[];
            }
        }
    })
</script>
</html>
经验分享 程序员 微信小程序 职场和发展