Return to site

Slots Vs Props Vue

broken image


  1. Slots Vs Props Vue Online
  2. Slots Vs Props Vue On Tv
  3. Slots Vs Props Vue Free
  4. Slots Vs Props Vue App

A slot allows you to display an element in the child that is controlled by the parent. This helps make your components reusable. For example, let's say you have a child component that displays data as a line chart, with the prop:chartData='chartData'. In terms of final output, slots perform a similar function as props in Vue — getting data from a parent component to a child component. However, whereas props pass data values to the component, slots can just pass direct template code. I think that this comes with a few benefits depending on the situation. Vue Select leverages scoped slots to allow for total customization of the presentation layer. Slots can be used to change the look and feel of the UI, or to simply swap out text. # footer 3.8.0+ Displayed at the bottom of the component, below.vsdropdown-toggle.

Vue

Displayed at the bottom of the component, below .vs__dropdown-toggle.

When implementing this slot, you'll likely need to use appendToBody to position the dropdown.Otherwise content in this slot will affect it's positioning.

  • search {string} - the current search query
  • loading {boolean} - is the component loading
  • searching {boolean} - is the component searching
  • filteredOptions {array} - options filtered by the search text
  • deselect {function} - function to deselect an option

Slots Vs Props Vue Online

#header3.8.0+

Displayed at the top of the component, above .vs__dropdown-toggle.

  • search {string} - the current search query
  • loading {boolean} - is the component loading
  • searching {boolean} - is the component searching
  • filteredOptions {array} - options filtered by the search text
  • deselect {function} - function to deselect an option

#list-footer3.8.0+

Displayed as the last item in the dropdown. No content by default. Parent element is the

    ,so this slot should contain a root
  • .

    Slots Vs Props Vue On Tv

    • search {string} - the current search query
    • loading {boolean} - is the component loading
    • searching {boolean} - is the component searching
    • filteredOptions {array} - options filtered by the search text

    #list-header3.8.0+

    Displayed as the first item in the dropdown. No content by default. Parent element is the

      ,so this slot should contain a root
    • .

      • search {string} - the current search query
      • loading {boolean} - is the component loading
      • searching {boolean} - is the component searching
      • filteredOptions {array} - options filtered by the search text

      #no-options

      The no options slot is displayed above list-footer in the dropdown whenfilteredOptions.length 0.

      • search {string} - the current search query
      • loading {boolean} - is the component loading
      • searching {boolean} - is the component searching

      #open-indicator

      The open indicator is the caret icon on the component used to indicate dropdown status.

      #option

      The current option within the dropdown, contained within

    • .

      • option {Object} - The currently iterated option from filteredOptions

      #search

      The search input has a lot of bindings, but they're grouped into attributes and events. Mostof the time, you will just be binding those two with v-on='events' and v-bind='attributes'.

      If you want the default styling, you'll need to add .vs__search to the input you provide.



      #selected-option

Props

Displayed at the bottom of the component, below .vs__dropdown-toggle.

When implementing this slot, you'll likely need to use appendToBody to position the dropdown.Otherwise content in this slot will affect it's positioning.

  • search {string} - the current search query
  • loading {boolean} - is the component loading
  • searching {boolean} - is the component searching
  • filteredOptions {array} - options filtered by the search text
  • deselect {function} - function to deselect an option

Slots Vs Props Vue Online

#header3.8.0+

Displayed at the top of the component, above .vs__dropdown-toggle.

  • search {string} - the current search query
  • loading {boolean} - is the component loading
  • searching {boolean} - is the component searching
  • filteredOptions {array} - options filtered by the search text
  • deselect {function} - function to deselect an option

#list-footer3.8.0+

Displayed as the last item in the dropdown. No content by default. Parent element is the

    ,so this slot should contain a root
  • .

    Slots Vs Props Vue On Tv

    • search {string} - the current search query
    • loading {boolean} - is the component loading
    • searching {boolean} - is the component searching
    • filteredOptions {array} - options filtered by the search text

    #list-header3.8.0+

    Displayed as the first item in the dropdown. No content by default. Parent element is the

      ,so this slot should contain a root
    • .

      • search {string} - the current search query
      • loading {boolean} - is the component loading
      • searching {boolean} - is the component searching
      • filteredOptions {array} - options filtered by the search text

      #no-options

      The no options slot is displayed above list-footer in the dropdown whenfilteredOptions.length 0.

      • search {string} - the current search query
      • loading {boolean} - is the component loading
      • searching {boolean} - is the component searching

      #open-indicator

      The open indicator is the caret icon on the component used to indicate dropdown status.

      #option

      The current option within the dropdown, contained within

    • .

      • option {Object} - The currently iterated option from filteredOptions

      #search

      The search input has a lot of bindings, but they're grouped into attributes and events. Mostof the time, you will just be binding those two with v-on='events' and v-bind='attributes'.

      If you want the default styling, you'll need to add .vs__search to the input you provide.



      #selected-option

      The text displayed within selected-option-container.

      This slot doesn't exist if selected-option-container is implemented.

      Slots Vs Props Vue Free

      • option {Object} - A selected option

      #selected-option-container

      This is the root element where v-for='option in selectedValue'. Most of the time you'll want touse selected-option, but this container is useful if you want to disable the deselect button,or have fine grain control over the markup.

      Slots Vs Props Vue App

      • option {Object} - Currently iterated selected option
      • deselect {Function} - Method used to deselect a given option when multiple is true
      • disabled {Boolean} - Determine if the component is disabled
      • multiple {Boolean} - If the component supports the selection of multiple values

      #spinner

      • loading {Boolean} - if the component is in a loading state




broken image