手机端与电脑端排行榜不同显示

This commit is contained in:
Himit_ZH 2021-04-22 11:28:40 +08:00
parent 51a178331d
commit 82184e670e
2 changed files with 34 additions and 6 deletions

View File

@ -91,6 +91,7 @@ export default {
limit: 30,
total: 0,
loadingTable: false,
screenWidth: 768,
dataRank: [],
options: {
tooltip: {
@ -126,10 +127,14 @@ export default {
showMaxLabel: true,
align: 'center',
formatter: (value, index) => {
if (this.isAuthenticated && this.userInfo.username == value) {
return utils.breakLongWords(value, 14);
if (this.screenWidth < 768) {
if (this.isAuthenticated && this.userInfo.username == value) {
return utils.breakLongWords(value, 14);
} else {
return '';
}
} else {
return '';
return utils.breakLongWords(value, 14);
}
},
},
@ -173,6 +178,15 @@ export default {
},
};
},
created() {
this.screenWidth = window.screen.width;
const that = this;
window.onresize = () => {
return (() => {
that.screenWidth = document.documentElement.clientWidth;
})();
};
},
mounted() {
this.getRankData(1);
},

View File

@ -91,6 +91,7 @@ export default {
total: 0,
dataRank: [],
loadingTable: false,
screenWidth: 768,
options: {
tooltip: {
trigger: 'axis',
@ -126,10 +127,14 @@ export default {
showMaxLabel: true,
align: 'center',
formatter: (value, index) => {
if (this.isAuthenticated && this.userInfo.username == value) {
return utils.breakLongWords(value, 14);
if (this.screenWidth < 768) {
if (this.isAuthenticated && this.userInfo.username == value) {
return utils.breakLongWords(value, 14);
} else {
return '';
}
} else {
return '';
return utils.breakLongWords(value, 14);
}
},
},
@ -163,6 +168,15 @@ export default {
},
};
},
created() {
this.screenWidth = window.screen.width;
const that = this;
window.onresize = () => {
return (() => {
that.screenWidth = document.documentElement.clientWidth;
})();
};
},
mounted() {
this.getRankData(1);
},