Skip to content

Commit dcf6574

Browse files
committed
add problem title link
1 parent 3c0e908 commit dcf6574

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<template>
2+
<div>
3+
<router-link :to="( '/problem/' + String(this.pid))" class="text-normal">{{this.title}} </router-link>
4+
</div>
5+
</template>
6+
7+
<script>
8+
import apiurl from './../../apiurl';
9+
10+
export default {
11+
name: 'ProblemTitleLink',
12+
props: {
13+
pid: {
14+
type: Number,
15+
required: true
16+
}
17+
},
18+
data() {
19+
return {
20+
title: new String()
21+
};
22+
},
23+
methods: {
24+
loadproblem(id) {
25+
this.$axios
26+
.get(apiurl('/problem/' + String(id)))
27+
.then(res => {
28+
this.title = '#' + String(id) + '.' + res.data.res.title;
29+
})
30+
.catch(() => {
31+
this.title = '#' + String(id);
32+
});
33+
}
34+
},
35+
mounted() {
36+
console.log(this.pid);
37+
this.title = '#' + this.pid;
38+
this.loadproblem(this.pid);
39+
}
40+
};
41+
</script>

0 commit comments

Comments
 (0)