In this page you’ll find:
Table of Contents |
---|
Goal
The purpose of this article is to show you how to extend the existing search box widget.
Overview
All components in the Vue.js framework are quite extendable and can be modified to handle custom layout, styles and behaviour. This is possible due to the built-in capability of the platform to attach templates as script tag and therefore supplying a dynamic structure of the presentation.
Prerequisite
Info |
---|
Configured Hawksearch widgets - Kentico: Working with widgets |
Extending the template
In order to replace the current default view file the Hawksearch search box widget uses you need to create a .cshtml view file in your ASP .NET Core project at Views/Shared/Components/Widgets/SearchBox/_Default.cshtml. The way the connector is designed it will automatically find that .cshtml file and use it instead of the default one. Below is the default cshtml code used.
...
Feel free to modify the given code to your liking, but there are a few things to be careful of. It is important to note that the overall widget needs to be wrapped in a div element with the class “vue-app-wrapper-ae“ and to have the data attributes present as in the snippet above, otherwise functionality might not work as expected. Currently, the connector locates those divs in a page when initializing the Vue.js components.
Additional resources
Info |
---|
If you’d like to use some additional components, please refer to the following pages:
|