Vue TabPanel - Control the Behavior
An end user can switch the views by swiping them or selecting tabs. Note that tab navigation is always enabled, while swiping is active only on touch devices by default. To enable it on all types of devices, assign true to the swipeEnabled property. Otherwise, assign false.
- <template>
- <DxTabPanel
- :swipe-enabled="false"
- />
- </template>
- <script>
- import 'devextreme/dist/css/dx.light.css';
- import DxTabPanel from 'devextreme-vue/tab-panel';
- export default {
- components: {
- DxTabPanel
- }
- };
- </script>
You can switch the views progrmmatically using the selectedIndex or selectedItem property.
- <template>
- <DxTabPanel
- v-model:selected-index="selectedIndex"
- />
- </template>
- <script>
- import 'devextreme/dist/css/dx.light.css';
- import DxTabPanel from 'devextreme-vue/tab-panel';
- export default {
- components: {
- DxTabPanel
- },
- data() {
- return {
- selectedIndex: 1
- }
- }
- };
- </script>
The TabPanel can loop the views, which enables an end user to swipe through the last view to the first and vice versa. To enable this behavior, set the loop property to true.
- <template>
- <DxTabPanel
- :loop="false"
- />
- </template>
- <script>
- import 'devextreme/dist/css/dx.light.css';
- import DxTabPanel from 'devextreme-vue/tab-panel';
- export default {
- components: {
- DxTabPanel
- }
- };
- </script>
To specify whether or not to animate switching between views, use the animationEnabled property.
- <template>
- <DxTabPanel
- :animation-enabled="true"
- />
- </template>
- <script>
- import 'devextreme/dist/css/dx.light.css';
- import DxTabPanel from 'devextreme-vue/tab-panel';
- export default {
- components: {
- DxTabPanel
- }
- };
- </script>
See Also
If you have technical questions, please create a support ticket in the DevExpress Support Center.