DruxtRouterEntityMixin
View source on GitHubDruxtRouterEntityMixin
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
entitiesstate tothis->entities.
Kind: static property of DruxtRouterEntityMixin
See: src/store.js
Properties
| Name | Type | Description |
|---|---|---|
| entities | object | The mapped Druxt Router Vuex entities state. |
.methods
Vue.js Methods.
- Maps Vuex
druxtRouter/getEntityaction tothis->getEntity(). - Maps Vuex
druxt/getResourceaction tothis->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
| Name | Type | Description |
|---|---|---|
| entity | object | The Drupal entity JSON:API resource. |
| loading | boolean | The loading state. |