New Dec 28, 2024

How to Add HTML Attribute Type with Autocomplete to Vue Props?

Libraries, Frameworks, etc. All from Newest questions tagged vue.js - Stack Overflow View How to Add HTML Attribute Type with Autocomplete to Vue Props? on stackoverflow.com

Here I'm trying to create a 'type' props with values of HTML input type but it's of type string. Is there a way to do that except of creating enum by myself?

(property) HTMLInputElement.type: string Returns the content type of the object.

import Input from "./input/Input.vue";

interface SearchInputProps { search: string; placeholder?: string; type?: HTMLInputElement["type"]; // still of type string }

withDefaults(defineProps<SearchInputProps>(), { placeholder: "Search", type: "text", });

const emit = defineEmits<{ (event: "search-input", input: string): void; }>(); </script>

Scroll to top