...
Info |
---|
Node dependencies:
|
Steps for customizations
Create a subfolder alongside the Vue SDK initialization file (e.g. assets/js/hawksearch/vue/components)
Create a ResultItem Vue single file component in it.
assets/js/hawksearch/vue/components/ResultItem.vueCode Block language js <template> <div class="custom-classes" v-on:click="onClick"> <p>{{ customMethod() }}</p> </div> </template> <script> import { ResultItem } from '@hawksearch/vue'; export default { extends: ResultItem, methods: { customMethod: function () { return 'Lorem ipsum'; } } }; </script>
Note that in this file both template and scripts are initialized
The default ResultItem component is imported from the Vue SDK and the custom one extends it
A customMethod is additionally defined for this component
The newly created file must be included in the initialization script and attached to his parent
assets/js/hawksearch/vue/index.jsCode Block ... import { ResultListing } from '@hawksearch/vue'; import ResultItem from './components/ResultItem.vue'; ResultListing.components.ResultItem = ResultItem; ...
Info |
---|
For additional information on component customizations, follow this article, or review the publically available Vue SDK at https://github.com/hawksearch/vue-hawksearch |