Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/Widgets/ListInput.vue
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | export default { | ||||
if (focus !== false) { | if (focus !== false) { | ||||
this.input.focus() | this.input.focus() | ||||
} | } | ||||
if (this.list.length == 1) { | if (this.list.length == 1) { | ||||
this.$el.classList.remove('is-invalid') | this.$el.classList.remove('is-invalid') | ||||
} | } | ||||
this.$emit('change', this.$el) | |||||
} | } | ||||
}, | }, | ||||
deleteItem(index) { | deleteItem(index) { | ||||
this.$delete(this.list, index) | this.$delete(this.list, index) | ||||
this.$emit('change', this.$el) | |||||
if (!this.list.length) { | if (!this.list.length) { | ||||
this.$el.classList.remove('is-invalid') | this.$el.classList.remove('is-invalid') | ||||
} | } | ||||
}, | }, | ||||
keyDown(e) { | keyDown(e) { | ||||
if (e.which == 13 && e.target.value) { | if (e.which == 13 && e.target.value) { | ||||
this.addItem() | this.addItem() | ||||
e.preventDefault() | e.preventDefault() | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
</script> | </script> |