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