Skip to content

Migrate from vue-epg ​

vue-epg compares distances across all items; vuEPG searches through the EPGGroup hierarchy. See Navigation rules and review these differences when migrating.

Compare before migrating ​

This table uses the npm vue-epg 2.3.1 implementation to explain migration benefits and application logic to retain.

Areavue-epgvuEPGTradeoff
Framework and integrationVue 2 plugin with v-items / v-group and $serviceVue 2.7 / Vue 3 with shared directives and APIsUpgrade Vue 2.6 first; migrate existing pages incrementally
NavigationGeometric search among registered items; groups intercept exit directionsSearches through live DOM groups with default entriesRegional boundaries are explicit; verify cross-group targets again
Back handlingA mixin reads serviceBackonBack() follows component and KeepAlive lifecyclesClosing dialogs restores page handling; update registration
XPath and saved positionsgetEleByPath() and getPointerPosition()Node queries and focus APIs, without built-in XPathRetain an application XPath utility or switch to stable business IDs
Dependencies and keysn-zepto and xpath-dom; prevents defaults for all keysZero runtime dependencies, configurable keys and editable text inputFewer dependencies; review custom input against the new rules

Directives ​

Replace unsupported v-items / v-group with v-epg-item / v-epg-group.

$service ​

vue-epg exposes $service; vuEPG provides $epg:

vue
<!-- vue-epg -->
<div v-items @up="$service.move(...)">...</div>

<!-- vuEPG -->
<div v-epg-item @epg-up="$epg.move(...)">...</div>

If you cannot update all code immediately, add a temporary alias:

ts
import { useVuEPG } from "vuepg";

// Vue 3
app.config.globalProperties.$service = useVuEPG();
// Vue 2
Vue.prototype.$service = useVuEPG();

serviceBack ​

vue-epg reads serviceBack through a mixin. vuEPG uses onBack. A temporary global mixin can adapt existing Options API code; avoid it for long-term use:

ts
import { useVuEPG } from "vuepg";

Vue.mixin({
  created() {
    if (typeof this.serviceBack === "function") {
      useVuEPG().onBack(() => this.serviceBack());
    }
  },
});

Keys ​

vue-epg calls preventDefault() for all keys, disabling default browser behavior such as number input. vuEPG limits it to predefined actions and allows per-action configuration. See Key mappings.

Removed features ​

vue-epgReplacement
XPath: getPointerPosition(), getEleByPath(xpath)Implement in your application if needed.
Automatic group classAdd the class directly to the group element.