all files / src/components/ AddItemComponent.vue

100% Statements 9/9
50% Branches 1/2
100% Functions 2/2
100% Lines 8/8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32                                                 
//
//
//
//
//
//
//
//
//
 
export default {
  props: ['id'],
  data () {
    return {
      newItem: ''
    }
  },
  methods: {
    addItem () {
      var text
 
      text = this.newItem.trim()
      Eif (text) {
        this.$emit('add', this.newItem)
        this.newItem = ''
        this.$store.dispatch('updateList', this.id)
      }
    }
  }
}