[+] Click tag to sort by tag
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
<div id="subtitle" v-if="meta.subtitle">{{meta.subtitle}}</div>
|
<div id="subtitle" v-if="meta.subtitle">{{meta.subtitle}}</div>
|
||||||
<div class="tags">
|
<div class="tags">
|
||||||
<div v-if="tagOnTop" style="display: inline-block">
|
<div v-if="tagOnTop" style="display: inline-block">
|
||||||
<Tag v-for="t in meta.tags" :key="t" direction="left">{{t}}</Tag>
|
<Tag v-for="t in meta.tags" :key="t" direction="left" @click="e => clickTag(e, t)">{{t}}</Tag>
|
||||||
</div>
|
</div>
|
||||||
<i id="pin" class="fas fa-thumbtack" v-if="meta.pinned"></i>
|
<i id="pin" class="fas fa-thumbtack" v-if="meta.pinned"></i>
|
||||||
</div>
|
</div>
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
<img class="title-image" :src="image" v-if="image && !imageOnTop" alt="Title Image">
|
<img class="title-image" :src="image" v-if="image && !imageOnTop" alt="Title Image">
|
||||||
<div id="preview" class="markdown-content" v-html="content"></div>
|
<div id="preview" class="markdown-content" v-html="content"></div>
|
||||||
<div class="tags" v-if="!tagOnTop">
|
<div class="tags" v-if="!tagOnTop">
|
||||||
<Tag v-for="t in meta.tags" :key="t" direction="right">{{t}}</Tag>
|
<Tag v-for="t in meta.tags" :key="t" direction="right" @click="e => clickTag(e, t)">{{t}}</Tag>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -26,13 +26,14 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {Options, Vue} from 'vue-class-component';
|
import {Options, Vue} from 'vue-class-component';
|
||||||
import {Prop, Watch} from "vue-property-decorator";
|
import {Emit, Prop, Watch} from "vue-property-decorator";
|
||||||
import {hosts} from "@/scripts/constants";
|
import {hosts} from "@/scripts/constants";
|
||||||
import {marked} from "marked";
|
import {marked} from "marked";
|
||||||
import Tag from "@/components/Tag.vue";
|
import Tag from "@/components/Tag.vue";
|
||||||
import $ from "jquery";
|
import $ from "jquery";
|
||||||
import 'jqueryui';
|
import 'jqueryui';
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
|
import router, {pushQuery} from "@/scripts/router";
|
||||||
|
|
||||||
export interface BlogPost
|
export interface BlogPost
|
||||||
{
|
{
|
||||||
@@ -69,8 +70,8 @@ export default class BlogPostPreview extends Vue
|
|||||||
this.isActiveChangeDueToClickTitle = true
|
this.isActiveChangeDueToClickTitle = true
|
||||||
|
|
||||||
// Change url
|
// Change url
|
||||||
if (!this.active) this.$router.push(`/blog?post=${this.meta.url_name}`)
|
if (!this.active) pushQuery({post: this.meta.url_name})
|
||||||
else this.$router.push('/blog')
|
else pushQuery({post: null})
|
||||||
}
|
}
|
||||||
|
|
||||||
mounted(): void
|
mounted(): void
|
||||||
@@ -109,6 +110,12 @@ export default class BlogPostPreview extends Vue
|
|||||||
if (this.active) document.title = `Blog: ${this.meta.title}`
|
if (this.active) document.title = `Blog: ${this.meta.title}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clickTag(e: PointerEvent, t: string): void
|
||||||
|
{
|
||||||
|
e.stopPropagation()
|
||||||
|
pushQuery({tag: t})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Element classes
|
* Element classes
|
||||||
*/
|
*/
|
||||||
@@ -143,6 +150,7 @@ export default class BlogPostPreview extends Vue
|
|||||||
|
|
||||||
.tags
|
.tags
|
||||||
font-size: 0.7em
|
font-size: 0.7em
|
||||||
|
z-index: 50
|
||||||
|
|
||||||
#pin
|
#pin
|
||||||
margin-left: 10px
|
margin-left: 10px
|
||||||
|
|||||||
Reference in New Issue
Block a user