feat: add input component

Signed-off-by: Ryan Wang <i@ryanc.cc>
pull/581/head
Ryan Wang 3 years ago
parent 982ba1f4f3
commit a2abc9362d

@ -0,0 +1,17 @@
<script lang="ts" setup>
defineProps({
modelValue: {
type: String,
},
});
const emit = defineEmits(["update:modelValue"]);
function handleInput(e: Event) {
const { value } = e.target as HTMLInputElement;
emit("update:modelValue", value);
}
</script>
<template>
<input type="text" :value="modelValue" @input="handleInput" />
</template>

@ -0,0 +1,8 @@
import { describe, expect, it } from "vitest";
import { VInput } from "../index";
describe("Input", () => {
it("should render", () => {
expect(VInput).toBeDefined();
});
});

@ -0,0 +1 @@
export { default as VInput } from "./Input.vue";

@ -4,7 +4,7 @@ export const routes: Array<RouteRecordRaw> = [
{ {
path: "/", path: "/",
name: "Dashboard", name: "Dashboard",
component: () => import("../views/AboutView.vue"), component: () => import("../views/HomeView.vue"),
}, },
{ {
path: "/about", path: "/about",

@ -1,3 +1,10 @@
<template> <template>
<main class="text-red-600">Hello Halo!</main> <main class="text-red-600">Hello Halo!</main>
<VInput v-model="value" />
{{ value }}
</template> </template>
<script lang="ts" setup>
import { VInput } from "@/components/base/input";
import { ref } from "vue";
const value = ref();
</script>

Loading…
Cancel
Save