|
@@ -11,7 +11,7 @@
|
|
|
>
|
|
|
<slot name="default" />
|
|
|
<span>
|
|
|
- <strong>{{ toCommaList(node.authors) }}</strong>,
|
|
|
+ <strong>{{ authors }}</strong>,
|
|
|
<button-url v-if="url && node.piece && node.piece.url" :link="node.piece" />
|
|
|
<button-url v-if="url && node.link && node.link.url" :link="node.link" />
|
|
|
</span>
|
|
@@ -44,7 +44,8 @@ export default {
|
|
|
block: { type: Boolean, default: false },
|
|
|
edition: { type: Boolean, default: false },
|
|
|
noDate: { type: Boolean, default: false },
|
|
|
- url: { type: Boolean, default: false }
|
|
|
+ url: { type: Boolean, default: false },
|
|
|
+ firstChar: { type: [String, null], default: null }
|
|
|
},
|
|
|
|
|
|
data () {
|
|
@@ -52,6 +53,20 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ computed: {
|
|
|
+ authors () {
|
|
|
+ if (!this.firstChar || this.node.authors.length < 2) return toCommaList(this.node.authors)
|
|
|
+ const authors = [...this.node.authors].sort((a, b) => a.last_name.localeCompare(b.last_name))
|
|
|
+ const first = this.node.authors.filter(author => author.last_name.startsWith(this.firstChar))
|
|
|
+ first.forEach((author) => {
|
|
|
+ const index = authors.indexOf(author)
|
|
|
+ authors.splice(index, 1)
|
|
|
+ authors.unshift(author)
|
|
|
+ })
|
|
|
+ return toCommaList(authors)
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
methods: {
|
|
|
trim,
|
|
|
toCommaList,
|