Skip to content

Commit

Permalink
Merge pull request #77 from wbxl2000/sourcecode
Browse files Browse the repository at this point in the history
feat: add random miao~ in 404 page
  • Loading branch information
godbasin authored Sep 2, 2024
2 parents 178e59c + ecf41be commit ab03cf1
Showing 1 changed file with 54 additions and 2 deletions.
56 changes: 54 additions & 2 deletions docs/.vuepress/theme/layouts/404.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,36 @@
<div class="theme-container">
<div class="theme-default-content">
<h1>404</h1>
<blockquote>{{ getMsg() }}</blockquote>
<blockquote>
{{ getMsg() }}
<el-row :gutter="20">
<el-col :xs="24" :sm="12">
<el-image :src="imgSrc" class="image-container">
<div slot="placeholder" class="image-slot">
<img src="https://github-imglib-1255459943.cos.ap-chengdu.myqcloud.com/assets/img/loading.gif"
style="width: 100%;" />
</div>
<div slot="error" class="image-slot">
<img src="https://github-imglib-1255459943.cos.ap-chengdu.myqcloud.com/chunzhu.jpg"
style="width: 100%;" />
</div>
</el-image>
</el-col>
</el-row>
</blockquote>
<router-link to="/">Take me home.</router-link>
</div>
</div>
</template>

<script>
function getImgSource() {
return (
"https://api.thecatapi.com/v1/images/search?format=src&t=" +
new Date().getTime()
);
}
const msgs = [
`There's nothing here.`,
`How did we get here?`,
Expand All @@ -18,9 +41,38 @@ const msgs = [
export default {
methods: {
getMsg () {
getMsg() {
return msgs[Math.floor(Math.random() * msgs.length)]
}
},
data() {
return {
imgSrc: getImgSource()
};
},
watch: {
$route(to) {
this.imgSrc = getImgSource();
}
}
}
</script>

<style lang="stylus">
@require '../styles/wrapper.styl'
.image-slot
width 100%
display block
.image-container
margin-top 20px
@media (max-width: $MQMobile)
.copyright-text
font-size 13px
.el-card__header
padding 8px 10px
font-size 13px
</style>

0 comments on commit ab03cf1

Please sign in to comment.