Vue LoadPanel - Show and Hide Using the API
To show or hide the LoadPanel programmatically, bind the visible property of the LoadPanel UI component to a component property. After that, change this property, and the LoadPanel will appear or disappear.
- <template>
- <div>
- <DxLoadPanel
- :hide-on-outside-click="true"
- v-model:visible="isLoadPanelVisible"
- />
- <DxButton
- text="Show the Load Panel"
- @click="handleClick"
- />
- </div>
- </template>
- <script>
- import 'devextreme/dist/css/dx.light.css';
- import { DxLoadPanel } from 'devextreme-vue/load-panel';
- import { DxButton } from 'devextreme-vue/button';
- export default {
- components: {
- DxLoadPanel,
- DxButton
- },
- data() {
- return {
- isLoadPanelVisible: false
- }
- },
- methods: {
- handleClick() {
- this.isLoadPanelVisible = true;
- }
- }
- }
- </script>
To execute certain commands before or after the LoadPanel is shown/hidden, handle the showing, shown, hiding or hidden event. If the event handling function is not going to be changed during the lifetime of the UI component, assign it to the corresponding onEventName property. For example, in the following code, a handler of the shown event is assigned to the onShown property. This handler hides the LoadPanel three seconds after it was shown.
- <template>
- <div>
- <DxLoadPanel
- :hide-on-outside-click="true"
- v-model:visible="isLoadPanelVisible"
- @shown="hideLoadPanel"
- />
- <DxButton
- text="Show the Load Panel"
- @click="handleClick"
- />
- </div>
- </template>
- <script>
- import 'devextreme/dist/css/dx.light.css';
- import { DxLoadPanel } from 'devextreme-vue/load-panel';
- import { DxButton } from 'devextreme-vue/button';
- export default {
- components: {
- DxLoadPanel,
- DxButton
- },
- data() {
- return {
- isLoadPanelVisible: false
- }
- },
- methods: {
- handleClick() {
- this.isLoadPanelVisible = true;
- },
- hideLoadPanel(e) {
- setTimeout(() => {
- e.component.hide();
- }, 3000);
- }
- }
- }
- </script>
See Also
If you have technical questions, please create a support ticket in the DevExpress Support Center.