mirror of
https://gitlab.com/bramw/baserow.git
synced 2025-04-25 13:23:42 +00:00
38 lines
854 B
Vue
38 lines
854 B
Vue
<template functional>
|
|
<div class="card-text">
|
|
<a
|
|
v-if="$options.methods.isValid(props.value)"
|
|
:href="props.value && props.value.url"
|
|
target="_blank"
|
|
rel="nofollow noopener noreferrer"
|
|
class="forced-pointer-events-auto"
|
|
@mousedown.stop
|
|
>
|
|
{{ $options.methods.getLabelOrUrl(props.value) }}
|
|
</a>
|
|
<template v-else>
|
|
{{ $options.methods.getLabelOrUrl(props.value) }}
|
|
</template>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { isValidURL } from '@baserow/modules/core/utils/string'
|
|
export default {
|
|
name: 'RowCardFieldLink',
|
|
methods: {
|
|
isValidURL,
|
|
isValid(value) {
|
|
return isValidURL(value?.url)
|
|
},
|
|
getLabelOrUrl(value) {
|
|
if (!value) {
|
|
return ''
|
|
} else {
|
|
return value.label ? value.label : value.url
|
|
}
|
|
},
|
|
},
|
|
height: 16,
|
|
}
|
|
</script>
|