Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

Save Automatically?

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 id="app">
  <div class="nav">
    <ul>
      <li v-for="(navItem, index) in navLists" @click="navFilter(index, navItem.status)" class="nav-item" :class="{ active: index==nowNav }">{{navItem.txt}}</li>
    </ul>
  </div>
  <div id="content">
    <div class="list isAlwaysTop" v-if="!showAddList && showInputTop" @click="showAddList=true">
      <div class="list-add">
        <i class="el-icon-plus"></i>
        <p class="input-main">Add Task</p>
      </div>   
    </div>
    <div class="list isAlwaysTop" v-if="showAddList">
      <div class="list-head">
        <input id="checkBox" type="checkbox">
        <input autofocus type="text" v-model="nowList.todoTitle" class="txt-main input-main" placeholder="Type Something Here…">
            <i @click="showAddList=false" :class="{isEdit: showAddList}" class="el-icon-edit"></i> 
      </div> 
      
      <div class="list-detail">
        <div class="list-input">
          <h3><i class="el-icon-date"></i>Deadline</h3>
          <el-date-picker
            v-model="nowList.tTime"
            type="datetime"
            format="yyyy/MM/dd hh:mm:ss"
            placeholder="Choose the datetime">
          </el-date-picker>
        </div>
        <div class="list-input">
          <h3><i class="el-icon-document"></i>File</h3>
          <div class="file-content">
            <p class="file-name" v-if="nowList.fileList.length > 0">{{nowList.fileList}}</p>
            <label for="file-upload" class="custom-file-upload">
              <i class="el-icon-plus"></i>
            </label>
            <input type="file" id="file-upload" @change="handleChange()" ref="fileInput">
          </div>
          
        </div>
        <div class="list-input">
          <h3><i class="el-icon-more"></i>Comment</h3>
          <textarea class="input-textarea" v-model="nowList.comment"  placeholder="Type your memo here…"></textarea>
        </div>
        <div class="btn-group">
          <button @click="goCancel()" class="btn btn-cancel"><i class="el-icon-close"></i>Cancel</button>
        <button :disabled="nowList.todoTitle==''" @click="goAddTask(nowList.todoTitle, nowList.tTime, nowList.fileList, nowList.comment)" class="btn btn-default"><i class="el-icon-plus"></i>Add Task</button>
        </div>

      </div>

    </div>
    <div  class="list" v-for="(todoList, index) in filterLists" :class="{ isStar: todoList.myStar, isEnd: todoList.status  }">
<!--       <pre>{{todoList}}</pre> -->
      <div class="list-head" :class="{ done: todoList.status}">
        <input :id="'checkBox' + index" type="checkbox" v-model="todoList.status">
        <input type="text" :disabled="nowClickNum != index" class="txt-main input-main" :placeholder="todoList.todoTitle" v-model="todoList.todoTitle">
            <i @click="isStar(index)" :class="[todoList.myStar ? 'el-icon-star-on' : 'el-icon-star-off']"></i>
            <i @click="(nowClickNum == index)? nowClickNum = -1:nowClickNum = index" class="el-icon-edit" :class="{isEdit: nowClickNum == index}"></i> 
        <div class="list-shorcut" v-if="!todoList.status">
          <span v-if="todoList.tTime">
            <i class="el-icon-date "></i>{{myDate(todoList.tTime)}}
          </span>
          
          <i v-if="todoList.fileList.length > 0" class="el-icon-document"></i>
          <i v-if="todoList.comment" class="el-icon-more"></i>
        </div>
      </div> 
      <transition name="fade">
      <div class="list-detail" v-if="nowClickNum == index">
        <div class="list-input">
          <h3><i class="el-icon-date"></i>Deadline</h3>
          <el-date-picker
            v-model="todoList.tTime"
            type="datetime"
            format="yyyy/MM/dd hh:mm:ss"
            value-format="yyyy/MM/dd"
            placeholder="选择日期时间">
          </el-date-picker>
        </div>
        <div class="list-input">
          <h3><i class="el-icon-document"></i>File</h3>
          <div class="file-content">
            <p class="file-name" v-if="todoList.fileList">{{todoList.fileList}}</p>
            <label :for="'file-upload'+index" class="custom-file-upload">
              <i class="el-icon-plus"></i>
            </label>
            <input type="file" :id="'file-upload'+index" @change="handleChange(index)" :ref="'fileInput'+index">
          </div>
        </div>
        <div class="list-input">
          <h3><i class="el-icon-more"></i>Comment</h3>
          <textarea class="input-textarea" v-model="todoList.comment"  placeholder="Type your memo here…"></textarea>
        </div>
        <div class="btn-group">
          <button @click="goCancel(index)" class="btn btn-cancel"><i class="el-icon-close"></i>Cancel</button>
        <button @click="goEdit(index, todoList.todoTitle, todoList.tTime, todoList.fileList, todoList.comment)" class="btn btn-default"><i class="el-icon-plus"></i>Save</button>
        </div>

      </div>
      </transition>
    </div>
  </div>
</div>
              
            
!

CSS

              
                // Color ------------------
$blue: #4A90E2;
$blue-dark: #00408B;
$red: #D0021B;
$yellow: #F5A623;
$grey-s: #F2F2F2;
$grey-m: #C8C8C8;
$grey-l: #757575;
$grey: #E1E1E1;
$white: #fff;
$black: #000;

// Base --------------------
body{
  font-family: 'Roboto', sans-serif;
  font-size: 16px;
  color: $black;
  background-color: $grey;
  
}
input:focus{
  outline: none;
}
h2, .txt-main{
  font-size: 24px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

h3{
  font-size: 20px;
  font-weight: 500;
}
#content{
  
  margin: 25px auto 0 auto;
  display: flex;
  flex-wrap: wrap;
  @media (min-width: 768px) {
    width: 620px;
  }
}

::-webkit-input-placeholder{
  color: $black;
}
// Componets ----------------
// btn
.btn-group{
  margin-top: 15px;
  display: flex;
}
.btn{
  cursor: pointer;
  width: 100%;
  padding: 15px;
  font-size: 24px;
  background-color: #fff;
  border-width: 0px;
  
  &.btn-default{
    background-color: $blue;
    color: $white;
  }
   &.btn-cancel{
    color: $red;
  }
  &:disabled {
    cursor: default;
    background-color: $grey-m;
  }
}
// Nav
.nav{
  background-color: $blue;
  ul{
    margin: 0 auto;
    display: flex;
     @media (min-width: 768px){
      width: 620px;
    }
  }
  .nav-item{
      font-size: 20px;
      padding: 25px 0;
      cursor: pointer;;
      flex: 1;
      text-align: center;
      color: $blue-dark;
      @media (min-width: 768px) {
        font-size: 24px;
    }
    &.active{
      font-weight: 500;
      color: $white;
      border-bottom: 5px solid $blue-dark;;
    }
   }
}
// List
.list{
  border-radius: 5px;
  width: 100%;
  background-color: $grey-s;
  margin-bottom: 10px;
}
.list-add{
  cursor: pointer;
  padding: 20px 30px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  color: $grey-m;
  background-color: $white;
  border: 2px solid #C8C8C8;
  border-radius: 5px;
  p {
    font-size: 24px;
  }
}
.list-head{
  padding: 25px 30px;
  
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  &.done{
    input::-webkit-input-placeholder, input {
      text-decoration: line-through;
      color: $grey-l;
    }
  }
}
.input-main{
  flex: 1;
  background-color: transparent;
  border-width: 0;
  margin-left: 10px;
}
.list-shorcut {
  width: 100%;
  color: $grey-l;
  margin-top: 15px;
  margin-left: 25px;
}
.list-detail{
  padding-top: 20px;
  border-top: 1px solid #000;
}
.list-input{
  padding: 10px 75px;
  h3{
    padding-bottom: 8px;
    margin-left: -30px;
  }
  input{
    width: 100%;
  }
  .input-textarea{
    width: 100%;
    box-sizing: border-box;
    height: 120px;
    padding: 10px 15px;
    font-size: 16px;
    &::-webkit-input-placeholder{
      color: $grey-m;
    }
  }
}
// icon
i{
  h3 & {
    font-size: 18px;
    padding-right: 10px ;
  }
  .btn &{
    padding-right: 15px;
  }
  .list-head &{
    font-size: 25px;
    margin-left: 30px;
  }
  .list-shorcut & {
    
    font-size: 17px;
    margin: 0 5px;
  }
}


//
.isAlwaysTop{
  order: -100;
  
}
.isStar{
  order: -1;
  background-color: #FFF2DC;
}
.isEnd{
  order: 100;
}
.isEdit{
  color: $blue;
}
.el-icon-star-on{
  color: $yellow;
}

// File
.file-content{
  margin-top: 5px;
  display: flex;
  align-items: center;
}
.file-name{
  margin-right: 20px;
}
input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}
.custom-file-upload{
  cursor: pointer;
  padding: 8px;
  color: $white;
  background-color: $grey-m;
  border-radius: 2px;
  
}


// animate for vuejs
.fade-enter-active, .fade-leave-active {
  transition: all .5s;
}
.fade-enter, .fade-leave-to {
  transform: translateY(10px);
  opacity: 0;
}
              
            
!

JS

              
                
new Vue({
  el: '#app',
  data () {
    return { 
        myStar: false,
        // nav part
        nowNav: 0,
        navLists: [{
          txt: 'My Tasks',
          status: 'all'
        },{
          txt: 'In Progress',
          status: false
        },{
          txt: 'Completed',
          status: true
        }],
        // toogle add list section
        showAddList: false,
        showInputTop: true,
        // edit list
        nowClickNum: -1,
        
        nowList: {
          todoTitle: '',
          tTime: '',
          fileList: '',
          comment: ''
        },
        filterLists: [],
        todoLists: [{
          todoTitle: 'Go Shopping',
          tTime: '2018-06-06T16:00:00.000Z',
          fileList: '',
          comment: 'hannah',
          status: false,
          myStar: false
        },{
          todoTitle: 'Finish hex to do list',
          tTime: '',
          fileList: '',
          comment: 'hahaha',
          status: false,
          myStar: false,
          fileTime: ''
        }],
    }
  },
  mounted () {
    this.filterLists = this.todoLists;
  },
  methods: {
    myDate(date){
      return (new Date(date).getMonth() + 1) + '/' + new Date(date).getDate();
    },
    isStar(index){
      this.todoLists[index].myStar = !this.todoLists[index].myStar;
    },
    //  Add Task ----------
    goAddTask(title = '', deadline = '', fileList = [], comment= '') {
      // todoLists.push
      this.todoLists.push({
         todoTitle: title,
          tTime: deadline,
          fileList: fileList,
          comment: comment,
          status: false,
          myStar: false
      });
      
      this.showAddList = false;
      //reset
      this.resetInput();

    },
    resetInput () {
       this.nowList =  {
          todoTitle: '',
          tTime: '',
          fileList: [],
          comment: ''
        }
    },
    // upload
    handleChange(index) {
      
      if(index != undefined){
        console.log(this.$refs['fileInput'+index])
        this.todoLists[index].fileList = this.$refs['fileInput'+index][0].files[0].name;
      }else{
        this.nowList.fileList = this.$refs.fileInput.files[0].name;
      }
      
    },
    //cancel
    goCancel(index){
      if(index){
        // sub list
        this.nowClickNum = -1
      }else{
        // main add list
        this.showAddList = false;
      }
      this.resetInput();
      
    },
    // Edit
    goEdit (index, title = '', deadline = '', fileList = [], comment= '') {
        this.todoLists[index].todoTitle = title;
        this.todoLists[index].tTime = deadline;
        this.todoLists[index].fileList = fileList;
        this.todoLists[index].comment = comment;
       console.log('title:  ', title)
      console.log(index, this.todoLists)
      this.nowClickNum = -1;
      //reset
      this.resetInput();
    },
    // Filter Nav
    navFilter(index, navStatus){
      // actice tab nav
      this.nowNav = index;
      this.showAddList = false;
      // filter
      if(navStatus != 'all'){
        this.showInputTop = false;
        this.filterLists =  this.todoLists.filter(function(item){
            return item.status == navStatus;
        })
      }else{
        this.showInputTop = true;
        this.filterLists =  this.todoLists
      }
      
      
    }
  }
})
              
            
!
999px

Console