If you’re creating a custom InstantSearch widget because you didn’t find a built-in option for your use case,
consider opening a feature request to describe what you’re trying to build.
Existing connectors
Sometimes you might want to create a component which uses a piece of data not provided by any of the widgets. You also might want to make a custom component for having access to the data in different places than the template. You can do this with thecreateWidgetMixin function exposed by Vue InstantSearch.
It works together with the connectors from InstantSearch.js.
Connect the menu widget
Choose the All information from that connector will then be available to your template as well as your other Vue lifecycle methods (after
connectMenu connector for this example.created).
All information will be available on this.state on your instance, and will be null initially
(so make sure your code is safe by wrapping usage in the template for example in an v-if="state").Determine widget parameters
All connectors expect to be passed widget parameters.
Since these change over the lifecycle of a component, and are usually passed through props, the widget mixin expects a property
widgetParams on the component’s instance.
Create it with a computed property, based on props:Vue
Custom connectors
If you want to make your own connector, you can do that using a function with this signature:JavaScript