new card referencing

This commit is contained in:
André Weller
2019-06-15 00:57:59 +02:00
parent 5f5ceab923
commit 0ce517c80b

View File

@@ -1,5 +1,5 @@
<template lang="pug"> <template lang="pug">
.card(:class="checkReference") .card(:class="active")
p.card--title {{title}} p.card--title {{title}}
p.card--description {{desc}} p.card--description {{desc}}
.card--links .card--links
@@ -11,6 +11,11 @@
<script> <script>
export default { export default {
props: ['title', 'desc', 'url'], props: ['title', 'desc', 'url'],
data(){
return {
active:''
}
},
methods: { methods: {
async createCopyUrl() { async createCopyUrl() {
try { try {
@@ -25,20 +30,26 @@ export default {
}, },
createReferenceTag(tag){ createReferenceTag(tag){
return tag.replace(/ /g, '').toLowerCase() return tag.replace(/ /g, '').toLowerCase()
} },
},
computed: {
checkReference(){ checkReference(){
if(this.$route.query.card) { if(this.$route.query.card) {
const query = this.$route.query.card const query = this.$route.query.card
const title = this.createReferenceTag(this.$props.title) const title = this.createReferenceTag(this.$props.title)
return title === query this.active = title === query
? 'card--active' ? 'card--active'
: '' : ''
} }
}, },
}, },
created() {
this.checkReference();
},
watch: {
'$route': function() {
this.checkReference();
}
}
} }
</script> </script>