Vue小黑记事本

220 阅读1分钟
小黑记事本

小黑记事本

  • {{ index+1 }}. {{ item }}
  • 		</section>
    		<!-- 统计和清空 -->
    		<footer class="footer" v-show="list.length!=0">
    			<span class="todo-count" v-if="list.length!=0">
    				<strong>{{ list.length }}</strong> items left
    			</span>
    			<button v-show="list.length!=0" class="clear-completed" @click="clear">
    				Clear
    			</button>
    		</footer>
    
    	</section>
    	<script src="js/vue.js"></script>
    	<script>
    		var app = new Vue({
    			el: "#todoapp",
    			data: {
    				list: ["写代码", "吃饭饭", "睡觉觉"],
    				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>
    </body>