Skip to content

$props #4571

Closed
Closed
$props#4571
@Akryum

Description

@Akryum

A $props special attribute would be very handy to reuse generic components inside more specific ones. It would hold the props passed down to the component.

For example, I'd like to create a InputModal which would be a Modal with some predefined content (for example,one <input/>).

<template>
  <modal v-bind="$props">
    <input v-model="inputValue" :placeholder="placeholder" />
  </modal>
</template>

<script>
import Modal from './Modal.vue'

export default {
  props: {
    ...Modal.props,
    value: {},
    placeholder: String,
  },

  // ...
}
</script>

Here is a jsfiddle of the use case.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions