feat: search

Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
liyasthomas
2021-08-30 11:27:36 +05:30
parent 755540fb81
commit 407a125533
4 changed files with 72 additions and 229 deletions

View File

@@ -51,31 +51,28 @@
</SmartModal>
</template>
<script lang="ts">
import { defineComponent } from "@nuxtjs/composition-api"
<script setup lang="ts">
import { ref } from "@nuxtjs/composition-api"
import { HoppAction, invokeAction } from "~/helpers/actions"
import { spotlight, lunr } from "~/helpers/shortcuts"
import { spotlight as mappings, lunr } from "~/helpers/shortcuts"
export default defineComponent({
props: {
show: Boolean,
},
data() {
return {
search: "",
mappings: spotlight,
lunr,
}
},
methods: {
hideModal() {
this.search = ""
this.$emit("hide-modal")
},
runAction(command: HoppAction) {
invokeAction(command)
this.hideModal()
},
},
})
defineProps<{
show: boolean
}>()
const emit = defineEmits<{
(e: "hide-modal"): void
}>()
const search = ref("")
const hideModal = () => {
search.value = ""
emit("hide-modal")
}
const runAction = (command: HoppAction) => {
invokeAction(command)
hideModal()
}
</script>