This is a rewrite attempt of the Listbox component originally created as an experiment by Adam Wathan. It was inspired by recent rewrite in Ember by Gavin Joyce.
The approach taken here takes advantage of Vue SFC, and doesn't use context feature, by leveraging simple HoC created in computed properties that allow us to rely strictly on props and events, without having to operate on the context itself. This approach is well known in Ember ecosystem, where the yield
feature allows passing components with pre-programmed attributes and event handlers.
This approach has several advantages like:
The main disadvantage is that whenever props change in the main component, due to reactivity the HoC is recreated.
Note: Use this pattern with caution. While I like this idea a lot, it's more of an experiment than a recommended practice. Using context for such cases is still the recommended approach.
npm install
npm run serve
npm run build
npm run lint