Skip to content

Commit

Permalink
chore(#1): update frontend example
Browse files Browse the repository at this point in the history
  • Loading branch information
Decipher committed Sep 10, 2022
1 parent fdcfed3 commit dc8294a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<template>
<div v-if="field === 'links'">
@TODO - Node page links
</div>
<div v-else />
</template>

<script>
export default {
props: {
entity: {
type: Object,
required: true,
},
item: {
type: Object,
required: true,
}
},
computed: {
field: ({ item }) => item.configuration.id.split(':').pop(),
}
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<template>
<div v-html="html" />
</template>

<script>
export default {
props: {
entity: {
type: Object,
required: true,
},
item: {
type: Object,
required: true,
}
},
computed: {
field: ({ item }) => item.configuration.id.split(':').pop(),
html: ({ entity, field }) => {
if (!entity.attributes[field]) return undefined
if (typeof entity.attributes[field] === 'string') return entity.attributes[field]
if (typeof entity.attributes[field] === 'object' && entity.attributes[field].processed) return entity.attributes[field].processed
return undefined
}
}
}
</script>
1 change: 1 addition & 0 deletions example/nuxt/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ export default {
'druxt-router/nuxt',
'@druxt-contrib/layout-builder'
],
components: true,
druxt: { baseUrl }
}

0 comments on commit dc8294a

Please sign in to comment.