mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 10:04:05 +00:00
31 lines
646 B
Vue
31 lines
646 B
Vue
|
<template>
|
||
|
<Alert icon="👉">
|
||
|
Read more in <Link :to="link" v-text="computedTitle" />.
|
||
|
</Alert>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import { defineComponent } from '@nuxtjs/composition-api'
|
||
|
import { splitByCase, upperFirst } from 'scule'
|
||
|
|
||
|
export default defineComponent({
|
||
|
props: {
|
||
|
link: {
|
||
|
type: String,
|
||
|
required: true
|
||
|
},
|
||
|
title: {
|
||
|
type: String,
|
||
|
required: false
|
||
|
}
|
||
|
},
|
||
|
computed: {
|
||
|
computedTitle () {
|
||
|
// Guess title from link!
|
||
|
return this.title || this.link.split('/')
|
||
|
.filter(Boolean).map(part => splitByCase(part).map(p => upperFirst(p)).join(' ')).join(' > ')
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
</script>
|