feat: add not-found for changelog

This commit is contained in:
Justineo 2021-09-25 19:14:42 +08:00
parent 9dc42b82cf
commit 31e9b5726d
No known key found for this signature in database
GPG Key ID: B73F0979CF18A0EA

View File

@ -95,6 +95,14 @@
/>
</ul>
</section>
<section
v-if="filteredChangelog.length === 0"
class="not-found"
@click="updateShrugger"
>
<span class="emoji">{{ shrugger }} </span>
<p>没有符合条件的变更记录</p>
</section>
</article>
</template>
@ -125,6 +133,11 @@ function isMinor (version) {
return /^\d+\.(?:[1-9]|\d{2,}).0$/.test(version)
}
function getShrugger () {
const candidates = ['🤷🏻‍♀️', '🤷🏼‍♀️', '🤷🏽‍♀️', '🤷🏾‍♀️', '🤷🏿‍♀️', '🤷🏻‍♂️', '🤷🏼‍♂️', '🤷🏽‍♂️', '🤷🏾‍♂️', '🤷🏿‍♂️']
return candidates[Math.floor(Math.random() * candidates.length)]
}
export default {
name: 'one-changelog',
layout: 'default',
@ -146,7 +159,8 @@ export default {
compare: false,
tag: null,
from: null,
to: allVersions[0].value
to: allVersions[0].value,
shrugger: getShrugger()
}
},
computed: {
@ -180,9 +194,17 @@ export default {
}
}
},
mounted () {
['from', 'to', 'compare', 'tag', 'type'].forEach((key) => {
this.$watch(key, this.updateShrugger)
})
},
methods: {
isMajor,
isMinor
isMinor,
updateShrugger () {
this.shrugger = getShrugger()
}
}
}
</script>
@ -225,4 +247,21 @@ h2
small
font-size 18px
.not-found
display inline-flex
flex-direction column
align-items center
margin 32px
color #ababab
font-size 28px
cursor pointer
user-select none
.emoji
font-size 64px
opacity 0.75
p
margin 0 -0.75em 0 0
</style>