Files
hoppscotch/components/collections/Add.vue
2021-07-03 13:14:58 +00:00

52 lines
1.1 KiB
Vue

<template>
<SmartModal v-if="show" @close="hideModal">
<template #header>
<h3 class="heading">{{ $t("new_collection") }}</h3>
<div>
<ButtonSecondary icon="close" @click.native="hideModal" />
</div>
</template>
<template #body>
<label for="selectLabel">{{ $t("label") }}</label>
<input
id="selectLabel"
v-model="name"
class="input"
type="text"
:placeholder="$t('my_new_collection')"
@keyup.enter="addNewCollection"
/>
</template>
<template #footer>
<span></span>
<span>
<ButtonSecondary :label="$t('cancel')" @click.native="hideModal" />
<ButtonPrimary :label="$t('save')" @click.native="addNewCollection" />
</span>
</template>
</SmartModal>
</template>
<script>
export default {
props: {
show: Boolean,
},
data() {
return {
name: null,
}
},
methods: {
addNewCollection() {
this.$emit("submit", this.name)
this.hideModal()
},
hideModal() {
this.name = null
this.$emit("hide-modal")
},
},
}
</script>