LoginSignup
0
1

More than 3 years have passed since last update.

Vue.jsを使って簡単なtodoアプリを作ってみた

Last updated at Posted at 2020-01-18

Vue.jsを使って簡単なtodoアプリを作ってみた

身内用進捗内容報告記事

初めに

Vue.jsが初めてのjsライブラリとなったが苦難することなく作ることができた

デモ

コード

HTML

<div id="app">
  <div>
    <li v-for="(todo, i) in todos">
     {{ todo.text }}
     <button @click="remove(i)">
    削除
  </button>
    </li>
  </div>
  <input v-model="todo" >
  <button @click="add">
    追加
  </button>
</div>

javascript

var app = new Vue({
  el: '#app',
  data: {
    todos: [],
    todo: 'sample',
  },

  methods: {
    add() {
      this.todos.push({ text: this.todo })
    },

    remove(i) {
      this.todos.splice(i, 1) 
    }
  }
}) 
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1