はじめに ゆるいAtomicDesignを意識してForm部品をComponent化してみました。 Input <template> <label> <span v-if="$slots.label"><slot name="label"></slot></span> <span v-else-if="label">{{ label }}</span> <input :type="type" :name="name" :placeholder="placeholder" :value="value" @input="updateValue" @focus="$emit('focus', $event)" @blur="$emit('blur', $event)" > </label> </template> <script> export default { props: { value:
![Vue.jsでForm部品をComponent化する - Qiita](https://cdn-ak-scissors.b.st-hatena.com/image/square/19b6e5a18172279b01f58b5a7a152308bbf7cb2b/height=288;version=1;width=512/https%3A%2F%2Fqiita-user-contents.imgix.net%2Fhttps%253A%252F%252Fcdn.qiita.com%252Fassets%252Fpublic%252Fadvent-calendar-ogp-background-7940cd1c8db80a7ec40711d90f43539e.jpg%3Fixlib%3Drb-4.0.0%26w%3D1200%26mark64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTk3MiZoPTM3OCZ0eHQ9VnVlLmpzJUUzJTgxJUE3Rm9ybSVFOSU4MyVBOCVFNSU5MyU4MSVFMyU4MiU5MkNvbXBvbmVudCVFNSU4QyU5NiVFMyU4MSU5OSVFMyU4MiU4QiZ0eHQtYWxpZ249bGVmdCUyQ3RvcCZ0eHQtY29sb3I9JTIzM0EzQzNDJnR4dC1mb250PUhpcmFnaW5vJTIwU2FucyUyMFc2JnR4dC1zaXplPTU2JnM9NzhjOWMxNzkwZjk5ZTc2ODc0M2I2NzkwMTM0MDgzZmI%26mark-x%3D120%26mark-y%3D96%26blend64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZoPTc2Jnc9OTcyJnR4dD0lNDB3YWthbWVfaXNvbm9fJnR4dC1jb2xvcj0lMjMzQTNDM0MmdHh0LWZvbnQ9SGlyYWdpbm8lMjBTYW5zJTIwVzYmdHh0LXNpemU9MzYmdHh0LWFsaWduPWxlZnQlMkN0b3Amcz1kNzg1MDU4OTljNWVlOTMwNjg3YmE0OTE3NzhjZWYxNg%26blend-x%3D120%26blend-y%3D500%26blend-mode%3Dnormal%26s%3D0104d02fdb5630899d00c29b99428b47)