move to vue-blogify
This commit is contained in:
1 parent
4fe597979c
commit
bb1e397daa
90 files changed
+10347
-2666
No files matched your search
@@ -0,0 +1,49 @@
|
||||
<template lang="pug">
|
||||
div
|
||||
div(v-if="filename")
|
||||
post(:is-teaser="false" :filename="filename")
|
||||
vue-disqus(:shortname="disqus" :identifier="$route.path")
|
||||
div(v-else="")
|
||||
empty
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Vue, Component, Prop } from "vue-property-decorator";
|
||||
import Post from "@/layouts/Post.vue";
|
||||
import Empty from "@/layouts/Empty.vue";
|
||||
import moment from "moment";
|
||||
import { g } from '../shared';
|
||||
import { dotGetter } from '../plugins/search';
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
Post, Empty
|
||||
}
|
||||
})
|
||||
export default class Search extends Vue {
|
||||
private filename: string = "";
|
||||
|
||||
private disqus: string = dotGetter(g.config, "external.disqus");
|
||||
|
||||
public mounted() {
|
||||
const ps = g.posts.filter((p) => {
|
||||
const m = moment(p.date);
|
||||
if (m.format("YYYY") === this.$route.params.y && m.format("MM") === this.$route.params.mo) {
|
||||
if (p.filename
|
||||
.replace(/^.*\//, "")
|
||||
.replace(/\.[^.]+$/, "") === this.$route.params.name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
if (!ps[0]) {
|
||||
this.filename = "";
|
||||
}
|
||||
|
||||
this.filename = ps[0].filename;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in new issue
Block a user