Skip to content

Version notice

1.x is no longer maintained; these docs remain for existing applications. New projects should use 2.x. Existing projects can follow Upgrade from 1.x.

Back callbacks ​

vuEPG invokes a global or component callback for the BACK action.

Global callback ​

Configure at any time through setConfig:

javascript
const router = useRouter;

epg.setConfig({
  defBackHandler: () => {
    router.go(-1);
  },
});

Component callback ​

WARNING

  • Active while the Vue component is Mounted/Activated, inactive when Deactivated/Unmounted.
  • While a component callback is active, the global callback is not invoked.

Type ​

typescript
const onBack: (func: Function) => void;

Composition API ​

vue
<script setup>
import { useVuEPG } from "vuepg";
const epg = useVuEPG();
epg.onBack(() => {
  console.log("Component Back callback");
});
</script>

Options API ​

vue
<script>
import { defineComponent } from "vue";
import { useVuEPG } from "vuepg";

const epg = useVuEPG();
export default defineComponent({
  created() {
    epg.onBack(() => {
      console.log("Component Back callback");
    });
  },
});
</script>