Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
NOTE EDITOR WEB APP <br><br>
<div id="notes">
<!-- Panel for holding our input -->
<input type="text" placeholder="Enter notes here?" autofocus class="text-input" v-model="newNote" v-on:keyup.enter="addNote">
<ul>
  <li v-for="note in notes">
    {{ note.text }} <button @click="editNote(note)">EDIT</button>
    <input type="text" v-model="note.text" @blur="doneEdit(note)" v-show="note == activeEdit">
  </li>
</ul>
</div>
  
  
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.3/vue.js"></script>
  
</body>
</html>
 
const app = new Vue({
  
  el: '#notes',
  
  data: {
    notes: [],
    newNote: '',
    activeEdit: null
  },
  
  methods: {
    addNote() {
      let note = this.newNote.trim()
      
      if(note) {
        this.notes.push({
          text: note
        })
        this.newNote = ''
      }
    },
    editNote(note) {
      this.activeEdit = note
    },
    doneEdit(note) {
      if (!this.activeEdit) {
        return
      }
      this.activeEdit = null
      note.text = note.text.trim()
    }
  }
  
})
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
bedakbpro
0viewers