This commit is contained in:
ronger 2021-02-05 09:44:51 +08:00
parent a87f5afb30
commit e2b19bd2dc

View File

@ -101,30 +101,31 @@ export default {
watch: { watch: {
'$route.query': function () { '$route.query': function () {
let _ts = this; let _ts = this;
_ts.$set(_ts, 'activeTab', _ts.$route.query.tab) let activeTab = _ts.$route.query.tab || '0'
_ts.$set(_ts, 'activeTab', activeTab)
switch (_ts.activeTab) { switch (_ts.activeTab) {
case "0": case "0":
_ts.$store.dispatch('user/fetchArticleList', { _ts.$store.dispatch('user/fetchArticleList', {
nickname: this.$route.params.nickname, nickname: _ts.$route.params.nickname,
page: this.$route.query.page || 1 page: _ts.$route.query.page || 1
}) })
break; break;
case "1": case "1":
_ts.$store.dispatch('user/fetchPortfolioList', { _ts.$store.dispatch('user/fetchPortfolioList', {
nickname: this.$route.params.nickname, nickname: _ts.$route.params.nickname,
page: this.$route.query.page || 1 page: _ts.$route.query.page || 1
}) })
break; break;
case "2": case "2":
_ts.$store.dispatch('user/fetchFollowerList', { _ts.$store.dispatch('user/fetchFollowerList', {
nickname: this.$route.params.nickname, nickname: _ts.$route.params.nickname,
page: this.$route.query.page || 1 page: _ts.$route.query.page || 1
}) })
break; break;
default: default:
_ts.$store.dispatch('user/fetchFollowingList', { _ts.$store.dispatch('user/fetchFollowingList', {
nickname: this.$route.params.nickname, nickname: _ts.$route.params.nickname,
page: this.$route.query.page || 1 page: _ts.$route.query.page || 1
}) })
break break
} }
@ -143,7 +144,7 @@ export default {
}, },
data() { data() {
return { return {
activeTab: '0', activeTab: this.$route.query.tab || '0',
isFollow: false isFollow: false
} }
}, },
@ -213,7 +214,6 @@ export default {
mounted() { mounted() {
let _ts = this; let _ts = this;
this.$store.commit('setActiveMenu', 'user'); this.$store.commit('setActiveMenu', 'user');
_ts.$set(_ts, 'activeTab', _ts.$route.query.tab || '0');
if (_ts.oauth) { if (_ts.oauth) {
_ts.$axios.$get('/api/follow/is-follow', { _ts.$axios.$get('/api/follow/is-follow', {
params: { params: {