add nova
This commit is contained in:
37
nova/resources/js/fields/Index/IdField.vue
Normal file
37
nova/resources/js/fields/Index/IdField.vue
Normal file
@@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<div :class="`text-${field.textAlign}`">
|
||||
<Link
|
||||
@click.stop
|
||||
v-if="fieldHasValue && !isPivot && authorizedToView"
|
||||
:href="$url(`/resources/${resourceName}/${field.value}`)"
|
||||
class="link-default"
|
||||
>
|
||||
{{ fieldValue }}
|
||||
</Link>
|
||||
<p v-else-if="fieldHasValue || isPivot">
|
||||
{{ field.pivotValue || fieldValue }}
|
||||
</p>
|
||||
<p v-else>—</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import isNil from 'lodash/isNil'
|
||||
import { FieldValue } from '@/mixins'
|
||||
|
||||
export default {
|
||||
mixins: [FieldValue],
|
||||
|
||||
props: ['resource', 'resourceName', 'field'],
|
||||
|
||||
computed: {
|
||||
isPivot() {
|
||||
return !isNil(this.field.pivotValue)
|
||||
},
|
||||
|
||||
authorizedToView() {
|
||||
return this.resource?.authorizedToView ?? false
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user