TodoList功能开发
<body> <div id="root"> <div> <input v-model="inputValue"/> <button @click="handleSubmit">提交</button> <ul> <li v-for="(item,index) of list" :key="index"> {{item}} </li> </ul> </div> </div> <script> // vue实例 new Vue({ el: "#root", data: { inputValue: ‘‘, list: [] }, methods: { handleSubmit: function () { this.list.push(this.inputValue); this.inputValue = ‘‘; } } }) </script> </body>
原文地址:https://www.cnblogs.com/-beauTiFul/p/9032077.html
时间: 2024-11-05 17:30:17