Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
Packaging smart Vue components for npm

Is it possible to create a Vue plugin for a smart component contra a dumb component and package it for npm?

Here’s an example of a smart component, that uses a dumb component BaseButton.

<template>
  <div class="increment-button" v-on:click="increment">
<base-button>{{ number }} Increment</base-button>
  </div>
</template>

<script>
// Base Button is dumb
const BaseButton = {
  template: `<button><slot></slot></button>`
}

// Increment Button is smart
export default {
  name: 'IncrementButton',
  components: { BaseButton },
  data () {
return {
  number: 0
}
  },
  methods: {
increment () {
  this.number++
}
  }
}
</script>

When I install my Vue plugin and instantiate my smart component, Vue doesn't recognize <base-button> as a Vue component and render it even though, I'm registering it globally in the install method.

Can someone guide me in the right direction?

Best, Bilal

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!