Skip to content

Commit

Permalink
feat(detail): add width, height, radius capabilities
Browse files Browse the repository at this point in the history
fixes #6
  • Loading branch information
chaseconey committed Aug 15, 2020
1 parent b78b26f commit 40bf6b0
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions resources/js/components/DetailField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<panel-item :field="field">
<div slot="value">

<img v-if="url" :src="url">
<img class="external-image-thumbnail" :style="{ width, height, borderRadius }" v-if="url" :src="url">

<span v-else>&mdash;</span>
</div>
Expand All @@ -11,17 +11,29 @@

<script>
export default {
props: ['resource', 'resourceName', 'resourceId', 'field'],
export default {
props: ['resource', 'resourceName', 'resourceId', 'field'],
computed: {
url() {
if (this.field.prefix) {
return `${this.field.prefix}${this.field.value}`;
}
return this.field.value;
}
computed: {
url () {
if (this.field.prefix) {
return `${this.field.prefix}${this.field.value}`
}
}
return this.field.value
},
width () {
console.log(this.field)
return this.field.width + 'px' || 'auto'
},
height () {
return this.field.height + 'px' || 'auto'
},
borderRadius () {
return this.field.borderRadius + 'px' || '0'
},
},
}
</script>

0 comments on commit 40bf6b0

Please sign in to comment.