Skip to content
router

DruxtRouterEntityMixin

View source on GitHub

DruxtRouterEntityMixin

The DruxtRouterEntityMixin Vue.js mixin provides easy integration with the DruxtJS Router Vuex store, including on-demand loading of JSON:API resources.

Kind: global mixin
Example

<template>
  <div v-if="!$fetchState.pending">
    {{ entity }}
  </div>
</template>

<script>
import { DruxtRouterEntityMixin } from 'druxt-router'

export default {
  mixins: [DruxtRouterEntityMixin]
}
</script>

.props

Vue.js Properties.

Kind: static property of DruxtRouterEntityMixin


.mode : string

The Drupal display mode.

Kind: static property of props
Default: "default"


.type : string

The JSON:API resource type.

Kind: static property of props


.uuid : string

The Drupal entity UUID.

Kind: static property of props


.computed

Vue.js Computed properties.

  • Maps Vuex entities state to this->entities.

Kind: static property of DruxtRouterEntityMixin
See: src/store.js
Properties

NameTypeDescription
entitiesobjectThe mapped Druxt Router Vuex entities state.

.methods

Vue.js Methods.

  • Maps Vuex druxtRouter/getEntity action to this->getEntity().
  • Maps Vuex druxt/getResource action to this->getResource().

Kind: static property of DruxtRouterEntityMixin
See: src/store.js


.fetch()

Loads the JSON:API resource via the Vuex store.

Kind: static method of DruxtRouterEntityMixin


.data()

Vue.js Data object.

Used for on-demand JSON:API resource loading.

Kind: static method of DruxtRouterEntityMixin
Properties

NameTypeDescription
entityobjectThe Drupal entity JSON:API resource.
loadingbooleanThe loading state.