Mixins
Navigator installs one global mixin, defined in applications/global/front-end/vue/mixins/mixins.js. Like the directives, it is applied by enCreateApp during loadLibraries(), so it lands on every component in the app — your own components as well as the EnForms and EnComponents library components.
js
// applications/global/front-end/vue/mixins/mixins.js
import * as filters from '@global/js/customFilterFunctions'
export default (vue) => {
vue.mixin({
data() {
return {
appUrls: window.appUrls,
}
},
methods: {
...filters
},
})
}It contributes exactly two things: the appUrls data property and every exported formatter as a method.
appUrls
A copy of the window.appUrls object that the Razor layout writes into the page, giving you the base URL of each app so you never hardcode a host when linking across them.
vue
<a :href="`${appUrls.employee}/employee/${employeeId}/profile`">View profile</a>The keys come from IAppUrlsConfig and are rendered per layout, so treat the exact set as layout-specific — most include benefits, employee, exports, and identity, and some add extras such as identity_server_uri.
Two consequences of it being data() rather than a computed or injected value:
- It is read from
window.appUrlswhen the component is created, so the layout's inline script must have run first. In practice it has, since the layout writes it in<head>. - Every component gets its own copy, and because it's in
datait is writable. Don't assign to it — treat it as read-only configuration.
Formatter methods
Everything exported from customFilterFunctions.js is spread into methods, which is why formatters can be called straight from any template with no import:
vue
<template>
<td>{{ enFormatMoney(plan.premium) }}</td>
<td>{{ enFormatDate(employee.hireDate) }}</td>
</template>The full list, with parameters and return values, is on the Formatters page.
Outside of a component — in a plain .js module, a composable, or a setup() block — the mixin doesn't apply, so import what you need directly:
js
import { enFormatMoney, enPascalToKebab } from '@global/js/customFilterFunctions'WARNING
Because this is a global mixin, every formatter name is effectively reserved on every component. If one of your components defines a method with the same name as a formatter, the component's own method wins (component options take priority over mixin options) and that formatter becomes unavailable in that component's template. The en prefix on the formatters is what keeps this from happening in practice — keep your own method names off that prefix.
Library mixins
The EnComponents package has its own internal mixins — table, pagination, and automation helpers that its components mix in themselves. Those are implementation details of the library rather than something to apply to your components; use the documented component props and the composables instead.