Skip to content

Commit 1bdb5e1

Browse files
committed
ADD: DayJS
ADD: Select Today First
1 parent dfa41cf commit 1bdb5e1

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

nuxt.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ module.exports = {
6868
src: '@/plugins/firebase-admin.js',
6969
ssr: true,
7070
},
71+
{
72+
src: '@/plugins/dayjs.js',
73+
ssr: true,
74+
},
7175
],
7276
/*
7377
** Nuxt.js dev-modules

src/pages/classes/index.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
<template>
22
<div class="MainPage">
33
<v-row class="DataBlock">
4-
<v-col
5-
v-for="(item, i) in Lessons['2020-04-04']"
6-
:key="i"
7-
cols="12"
8-
md="6"
9-
>
4+
<v-col v-for="(item, i) in Lessons[today]" :key="i" cols="12" md="6">
105
<StudyCard
116
:schooltime="i + 1"
127
:realtime="item.realTime"
@@ -27,6 +22,11 @@ export default {
2722
computed: {
2823
...mapGetters('modules/class', ['Lessons']),
2924
},
25+
data() {
26+
return {
27+
today: this.$dayjs().format('YYYY-MM-DD'),
28+
}
29+
},
3030
}
3131
</script>
3232

src/plugins/dayjs.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import dayjs from 'dayjs'
2+
3+
export default ({ app }, inject) => {
4+
inject('dayjs', (string) => dayjs(string))
5+
}

0 commit comments

Comments
 (0)