Vue Popover - Customize the Title
The Popover is displayed without a title by default. To add it, set the showTitle property to true and specify the title text using the title property. The title can contain a button that closes the Popover. To enable it, assign true to the showCloseButton property.
Code
- <template>
- <div>
- <img id="image" src="https://url/to/an/image" />
- <DxPopover
- show-event="dxhoverstart"
- hide-event="dxhoverend"
- :show-title="true"
- :show-close-button="true"
- target="#image"
- title="Popover Title">
- <!-- ... -->
- </DxPopover>
- </div>
- </template>
- <script>
- import 'devextreme/dist/css/dx.fluent.blue.light.css';
- import { DxPopover } from 'devextreme-vue/popover';
- export default {
- components: {
- DxPopover
- }
- }
- </script>
If you need to define the title completely, specify a template for it as shown in the following code:
Code
- <template>
- <div>
- <img id="image" src="https://url/to/an/image" />
- <DxPopover
- show-event="dxhoverstart"
- hide-event="dxhoverend"
- :show-title="true"
- target="#image"
- titleTemplate="titleTemplate">
- <template #titleTemplate>
- <p>Title template</p>
- </template>
- </DxPopover>
- </div>
- </template>
- <script>
- import 'devextreme/dist/css/dx.fluent.blue.light.css';
- import { DxPopover } from 'devextreme-vue/popover';
- export default {
- components: {
- DxPopover
- }
- }
- </script>
You can switch title templates on the fly just as you can do with content templates. Refer to the Switching Templates On the Fly topic for more information.