Skip to content

Commit 81e0b34

Browse files
committed
fix(view): websocket 分页可能导致的问题
1 parent de72aa7 commit 81e0b34

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

admin/src/views/api_excel/index.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ export default {
157157
},
158158
created() {
159159
this.listQuery = this.$route.query
160-
this.currentpage = parseInt(this.listQuery.page)
160+
const page = parseInt(this.listQuery.page)
161+
this.currentpage = isNaN(page) ? 1 : page
161162
const perPage = parseInt(this.$route.query.perPage)
162163
this.perpage = isNaN(perPage) ? this.perpage : perPage
163164
// this.fetchData()
@@ -222,7 +223,7 @@ export default {
222223
},
223224
initWebSocket() { // 初始化 weosocket
224225
if ('WebSocket' in window) {
225-
const url = process.env.WEBSOCKET + '?action=api_excel&token=' + getToken()
226+
const url = process.env.WEBSOCKET + '?action=api_excel&token=' + getToken() + '&page=' + this.currentpage + '&perPage=' + this.perpage
226227
this.websock = new WebSocket(url)
227228
this.websock.onmessage = this.onmessage
228229
this.websock.onopen = this.onopen

0 commit comments

Comments
 (0)