Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container" id="todo">
  <section class="panel marginleft30 padtop">
    <input type="text" placeholder="What do you need to do?" autofocus maxlength='40' class="text-input" v-model="newTask" v-on:keyup.enter="addTask">
    <button class='clear' v-on:click="clearList">Clear all <i class="material-icons">clear</i></button><p v-if='taskList.length > 0'> Task count: {{ taskList.length }}</p>
    <p v-else> No ToDos right now. </p>
    <button @click='numbered=!numbered; $forceUpdate()'>Toggle ToDos  numbers</button>
    <button @click='showdate=!showdate;$forceUpdate()'>Toggle ToDos date and time</button>
  </section>
  <ul class="list">
    <span v-for="(task,index) in  taskList" class='list-item' v-bind:class="{done: task.checked}">
      
      <span class='number' v-if='numbered'> {{index+1}}.</span> {{ task.text}} <span v-if='showdate' class='small date'>, date: {{task.dateMade}} at: {{task.timeMade}}</span>
      <button class="delete" v-on:click="removeTask(task)"><i class="material-icons">delete_forever</i></button>
      <input type="checkbox" class="checkbox right" v-model="task.checked" @click='finishTask(task)'>
    </span>
       
  </ul> 
  <div class='help'>
    <h2> How To Use </h2>
    <p> Type the title of the Todo and press enter to add a task. <br/>
      Click 'Delete' to remove the task from the list. <br/>
      Click on the checkbox to mark if the task is finished or not.
    <h2> About </h2>
    <p> I made this as my first VueJS app,<br/> I wanted to make a ToDo list with some additional features <br/>other than just simple add and remove todo.<br/>There are some lil' bits and pieces I wanted to do but I have to move on :) <br/>
      Check out my portfolio: <a href='http://www.danielfazlijevic.com/'>Daniel Fazlijevic portfolio </a>
    </p>
  </div>
</div>

              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Roboto');
input[type='text']{
  font-size: 20px;
  height: 37px;
  background: rgba(224,224,224 ,1);
  border-radius: 3px;
  padding-left: 13px;
  color: #212121;
}  
button{border: none; padding:5px;}
body{  
  background: #BF360C;  
  display: block;
}
.padtop{ padding-top: 5%;}
.marginleft30{ margin-left: 60px;}
.material-icons{ font-size: 20px;line-height: 20px;}
*{
  transition:  0.2s;
  font-family: 'Roboto', sans-serif;
}
.list-item{
  display: block;
  width: 600px;
  font-size: 20px;
  color: #212121;
  background: #EEEEEE;
  margin: 3px;
  height: 28px;
  padding:10px;
  border-radius: 3px;
}

.done{
  transition: 0.4s;
  background: #00ad31;
  color: #F5F5F5;
}
.clear{
  color: #fff;
  font-size: 20px;
  background: rgba(56,142,0 ,1);
  height: 42px;
  background: #00ad31;
}
.clear i{ font-size: 16px;}
.right{
  float: right;
}
button{
  border-radius: 3px;
  background: #F4511E;
  color: #EEEEEE;
}
button:hover{
  background:#FF5722;
}
.clear:hover{
  background: #00897B;
}
button{
  font-size: 16px;
}
.checkbox{
  width: 40px;
  height: 20px;
}
.help{
  float: right;
  margin-right: 10%;
  margin-top: -8%;
  text-shadow: 1px -1px 1px #7a4c23;
}
.help h2{ color: #F5F5F5;}
p{ color: #E0E0E0;}
.list{ float: left;}
.delete button:hover{ background: #fff; }
.date{ margin-right: -56%; }
.small{ font-size: 60%;}
.number {
  background: #d35400;
  padding: 12px 16px;
  margin-bottom: 3px;
  height: 31px;
  margin-left: -3%;
  color: white;
  margin-right: 2%;
  -webkit-border-top-left-radius: 7px;
  -webkit-border-bottom-left-radius: 7px;
  -moz-border-radius-topleft: 7px;
  -moz-border-radius-bottomleft: 7px;
  border-top-left-radius: 7px;
  border-bottom-left-radius: 7px;
}
.delete{ float: right;
  border: none;
  padding: 15px;
  width: 48px;
  margin-right: -3%;
  border: 0px;
  -webkit-border-top-right-radius: 7px;
  -webkit-border-bottom-right-radius: 7px;
  -moz-border-radius-topright: 7px;
  -moz-border-radius-bottomright: 7px;
  border-top-right-radius: 7px;
  border-bottom-right-radius: 7px;
  line-height: 10px;
  margin-top: -12px;
  transition: 0.3s;
  background: #b71c1c;
}
.delete:hover{
  background: #c40101;
}
a{
  color: #222426;
  text-shadow: none;
}
              
            
!

JS

              
                new Vue({
  el: "#todo",

  data: {
    newTask: "",
    taskList: [],
    date: "",
    showdate: true,
    numbered: false
  },
  methods: {
    addTask: function() {
      var task = this.newTask.trim();
      var date = new Date();
      var hours = date.getHours();
      var minutes = date.getMinutes();
      var time = hours + ":" + minutes;
      var day = date.getDate();
      var month = date.getMonth()+1;
      var fulldate = ('0' + day).slice(-2) + '/' + ('0' + month).slice(-2);
      var fulltime = ('0' + hours).slice(-2)+':'+('0'+minutes).slice(-2);
      if (task) {
        this.taskList.push({
          text: task,
          checked: false,
          finished: false,
          dateMade: fulldate,
          timeMade: fulltime
        });
        this.newTask = "";
      }
    },
    removeTask: function(task) {
      var index = this.taskList.indexOf(task);
      this.taskList.splice(index, 1);
    },
    finishTask: function(task){
      task.finished = !task.finished;
      console.log('The task is now ' + task.finished);
    },
    clearList: function() {
      this.taskList = [];
    },
    finishedTask: function(taskList) {
      var tdcount = taskList.length();
      var fnumber = 0;
      for (var i=0; i<tdcount; i++){
        if(taskList[i].hasOwnProperty('finished'))
        {
          fnumber++;
          console.log(fnumber);
        }
        return fnumber;
      }
    }
  }
});

              
            
!
999px

Console