88 class =" flex flex-col xl:justify-around md:mx-16 xl:p-16"
99 >
1010 <a
11- v-bind =" bindUrl "
11+ v-bind =" boundUrl "
1212 target =" _blank"
13- rel =" noopener "
13+ : rel =" rel "
1414 class =" text-rains-500 flex justify-center group sm:mt-8 lg:my-8 md:w-1/2"
1515 @click =" logClick('img')"
1616 >
2828 </a >
2929 <div class =" my-6 xl:px-6 xl:w-1/2" >
3030 <a
31- v-bind =" bindUrl "
31+ v-bind =" boundUrl "
3232 target =" _blank"
33- rel =" noopener "
33+ : rel =" rel "
3434 class =" block text-rains-500 no-underline mx-6 md:px-6 mt-4 hover:underline transition-all"
3535 @click =" logClick('heading')"
3636 ><h2 v-t =" `work.projects.${slug}.title`" class =" text-2xl font-semibold" /></a >
4242</template >
4343
4444<script >
45- import logClick from ' ~/mixins/logClick '
45+ import { computed } from ' @vue/composition-api '
4646
4747export default {
48- mixins: [logClick],
4948 props: {
5049 slug: {
5150 type: String ,
@@ -62,18 +61,35 @@ export default {
6261 svg: {
6362 type: [Boolean , Function ],
6463 default: false
64+ },
65+ shouldFollow: {
66+ type: Boolean ,
67+ default: false
6568 }
6669 },
67- computed: {
68- bindUrl () {
69- // Looks weird, but is needed to disable links if empty url is provided, because no href will be bound then
70- return this .url .length ? { href: ` ${ this .url } ?ref=developmint.de` } : {}
71- },
72- imageSources () {
73- return {
74- src: require (` ~/assets/img/work/${ this .slug } .jpg` ),
75- srcset: ` ${ require (` ~/assets/img/work/${ this .slug } @2x.jpg` )} 2x`
76- }
70+ setup (props , context ) {
71+ const logClick = (eventName ) => {
72+ context .root .$ga .event ({
73+ eventCategory: ' click' ,
74+ eventAction: ` work preview: ${ props .slug } - ${ eventName} `
75+ })
76+ }
77+
78+ // Looks weird, but is needed to disable links if empty url is provided, because no href will be bound then
79+ const boundUrl = computed (() => props .url .length ? { href: ` ${ props .url } ?ref=developmint.de` } : {})
80+
81+ const rel = computed (() => ` noopener${ props .shouldFollow ? ' ' : ' nofollow' } ` )
82+
83+ const imageSources = computed (() => ({
84+ src: require (` ~/assets/img/work/${ props .slug } .jpg` ),
85+ srcset: ` ${ require (` ~/assets/img/work/${ props .slug } @2x.jpg` )} 2x`
86+ }))
87+
88+ return {
89+ logClick,
90+ boundUrl,
91+ imageSources,
92+ rel
7793 }
7894 }
7995}
0 commit comments