Skip to content

Commit e8ee5c1

Browse files
committed
add ribbon for page
1 parent 159c45a commit e8ee5c1

File tree

3 files changed

+390
-133
lines changed

3 files changed

+390
-133
lines changed

dimple-ui-blog/src/App.vue

Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -5,60 +5,63 @@
55
</template>
66

77
<script>
8-
import { mapMutations } from "vuex";
8+
import {mapMutations} from "vuex";
9+
import Ribbons from '@/assets/js/ribbon.js'
910
1011
export default {
11-
components: {},
12-
data() {
13-
return {
14-
location: [],
15-
timer: "",
16-
showBackTop: true
17-
};
18-
},
19-
watch: {},
20-
mounted() {
21-
this.initPanel();
22-
},
23-
computed: {},
24-
methods: {
25-
...mapMutations(["setArchives", "setCategory", "setTags", "setNewComments", "setNewArticles", "setTotals"]),
26-
initPanel() {
27-
this.$api.listArchive({ countType: "month", pageNum: 1, pageSize: 1000 }).then((res) => {
28-
if (res.code === 200) {
29-
this.setArchives(res.rows);
12+
Ribbons,
13+
components: {},
14+
data() {
15+
return {
16+
location: [],
17+
timer: "",
18+
showBackTop: true
19+
};
20+
},
21+
watch: {},
22+
mounted() {
23+
this.initPanel();
24+
Ribbons.start()
25+
},
26+
computed: {},
27+
methods: {
28+
...mapMutations(["setArchives", "setCategory", "setTags", "setNewComments", "setNewArticles", "setTotals"]),
29+
initPanel() {
30+
this.$api.listArchive({countType: "month", pageNum: 1, pageSize: 1000}).then((res) => {
31+
if (res.code === 200) {
32+
this.setArchives(res.rows);
33+
}
34+
;
35+
});
36+
this.$api.listCategory().then((res) => {
37+
if (res.code === 200) {
38+
this.setTotals({key: "category", value: res.total});
39+
this.setCategory(res.rows);
40+
}
41+
});
42+
this.$api.listTag().then((res) => {
43+
if (res.code === 200) {
44+
this.setTotals({key: "tag", value: res.total});
45+
this.setTags(res.rows);
46+
}
47+
});
48+
this.$api.listComment({
49+
pageNum: 1,
50+
pageSize: 5
51+
}).then((res) => {
52+
if (res.code === 200) this.setNewComments(res.rows);
53+
});
54+
this.$api.listArticle({
55+
pageNum: 1,
56+
pageSize: 5,
57+
}).then((res) => {
58+
if (res.code === 200) {
59+
this.setTotals({key: "article", value: res.total});
60+
this.setNewArticles(res.rows);
61+
}
62+
});
3063
}
31-
;
32-
});
33-
this.$api.listCategory().then((res) => {
34-
if (res.code === 200) {
35-
this.setTotals({ key: "category", value: res.total });
36-
this.setCategory(res.rows);
37-
}
38-
});
39-
this.$api.listTag().then((res) => {
40-
if (res.code === 200) {
41-
this.setTotals({ key: "tag", value: res.total });
42-
this.setTags(res.rows);
43-
}
44-
});
45-
this.$api.listComment({
46-
pageNum: 1,
47-
pageSize: 5
48-
}).then((res) => {
49-
if (res.code === 200) this.setNewComments(res.rows);
50-
});
51-
this.$api.listArticle({
52-
pageNum: 1,
53-
pageSize: 5,
54-
}).then((res) => {
55-
if (res.code === 200) {
56-
this.setTotals({ key: "article", value: res.total });
57-
this.setNewArticles(res.rows);
58-
}
59-
});
6064
}
61-
}
6265
};
6366
</script>
6467

0 commit comments

Comments
 (0)