💍 Picking Specific Items From The Component | vue-subslot

vue-subslot is a small Vue.js component that can be used to capture (filter and limit) content from component slots.

selecting elements in javascript, select option in javascript, javascript select element by class, javascript select option value, dom selectors in javascript

🔥 Cleaner Slot API Give users a cleaner, more readable API!
🧠 Full Aperture Control Filter and limit unwanted content from apertures!
🐥 Tiny 1.04 KB minzipped!

How to make use of it:

Basic usage:

const CardHeader = {
  template: '<div><slot /></div>',
};
const Card = {
  template: `
    <div class="card">
      <div
        v-if="$subslots.cardHeader"
        class="card-header"
      >
        <!-- Pick out the Card Header from the default slot -->
        <subslot name="cardHeader" />
      </div>
      <div class="card-content">
        <!-- Use the remainder -->
        <subslot />
      </div>
    </div>
  `,
  components: {
    Subslot,
    CardHeader,
  },
  mixins: [
    Subslot.define({
      cardHeader: '@CardHeader:1',
    }),
  ],
};
new Vue({
  el: '#app',
  template: `
    <card>
      <!-- The Card Header will be positioned separetely from the content -->
      <card-header>
        My special card
      </card-header>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </card>
  `,
  components: {
    Card,
    CardHeader,
  }
});

Pick Specific Elements From Slot, vue-subslot Plugin/Github, javascript select element by id


See Demo And Download

Official Website(privatenumber): Click Here

This superior jQuery/javascript plugin is developed by privatenumber. For extra Advanced Usage, please go to the official website.

Share