vuepress-theme-reco/layouts/404.vue

70 lines
1.5 KiB
Vue
Raw Normal View History

2019-04-15 10:35:40 +08:00
<template>
2019-09-20 11:02:28 +08:00
<div class="theme-container" v-if="!noFoundPageByTencent">
2019-04-15 10:35:40 +08:00
<div class="content">
<h1>404</h1>
<blockquote>{{ getMsg() }}</blockquote>
<router-link to="/">Take me home.</router-link>
</div>
</div>
</template>
<script>
const msgs = [
`There's nothing here.`,
`How did we get here?`,
`That's a Four-Oh-Four.`,
`Looks like we've got some broken links.`
]
export default {
2019-09-20 11:02:28 +08:00
computed: {
noFoundPageByTencent () {
return this.$themeConfig.noFoundPageByTencent !== false
}
},
mounted () {
if (this.noFoundPageByTencent) {
2019-09-20 13:54:13 +08:00
const dom = document.createElement('script')
2019-09-20 11:02:28 +08:00
dom.setAttribute('homePageName', '回到首页')
dom.setAttribute('homePageUrl', '/')
dom.setAttribute('src', '//qzonestyle.gtimg.cn/qzone/hybrid/app/404/search_children.js')
document.body.append(dom)
}
},
2019-04-15 10:35:40 +08:00
methods: {
getMsg () {
return msgs[Math.floor(Math.random() * msgs.length)]
}
}
}
</script>
<style src="../styles/theme.styl" lang="stylus"></style>
<style lang="stylus">
.content
margin 4rem auto 0
max-width 800px
padding 0 2rem
.mod_404
.desc
.desc_link
display: inline-block
// margin: 20px 0
background: #424242!important
color: #ffffff
padding: 6px 20px!important
text-decoration: none!important
border-radius: 4px
@media screen and (max-width: 720px)
2019-12-20 18:18:14 +08:00
.mod_404
.desc
margin: 50px 0
.wrapper
margin 0!important
padding-top 20px
</style>