parsley/app/javascript/components/TaskListMiniForm.vue

46 lines
961 B
Vue
Raw Normal View History

2018-08-28 16:52:56 -05:00
<template>
<div>
<app-validation-errors :errors="validationErrors"></app-validation-errors>
<label class="label is-small">Add New List</label>
<div class="field has-addons">
<div class="control">
<input class="input is-small" type="text" v-model="taskList.name" @keydown="nameKeydownHandler">
</div>
<div class="control">
<button type="button" class="button is-primary is-small" @click="save">Add</button>
</div>
</div>
</div>
</template>
2024-10-02 14:34:50 -05:00
<script setup>
const emit = defineEmits(["save"]);
const props = defineProps({
taskList: {
required: true,
type: Object
2018-08-28 16:52:56 -05:00
},
2024-10-02 14:34:50 -05:00
validationErrors: {
required: false,
type: Object,
default: function() { return {}; }
}
});
function save() {
emit("save");
}
function nameKeydownHandler(evt) {
switch (evt.key) {
case "Enter":
evt.preventDefault();
save();
2018-08-28 16:52:56 -05:00
}
}
</script>