源码呢?急求,谢谢
源码呢?急求,谢谢
源码呢?急求,谢谢
2017-05-05
<template> <div app="testProps"> <h1>{{ msg }}</h1> <input v-on:keyup.enter="addItem" v-model="newItem"> <ul> <li v-for="item in items" v-bind:class="{ finished: item.isFinished }" v-on:click="toggleFinish(item)">{{ item.lable }}</li> </ul> </div> </template> <script> import Store from '../file' export default { data () { return { msg: 'Welcome to Your Vue.js App1', newItem:'', items:Store.fetch() } }, methods:{ addItem:function(){ this.items.push({lable:this.newItem,isFinished:false}) this.newItem = '' }, toggleFinish:function(item){ item.isFinished = !item.isFinished } }, watch : { items:{ handler:function(items){ Store.save(items) }, deep:true } } } </script> <style> .finished{ text-decoration:line-through } html{ height:100% } body{ display:flex; align-items:center; justify-content:center; height:100% } </style>
举报