Skip to content

Commit

Permalink
fix: 修复控制台error级别报错
Browse files Browse the repository at this point in the history
  • Loading branch information
simply-none committed Jan 19, 2024
1 parent d550607 commit bd60828
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
5 changes: 4 additions & 1 deletion src/stores/words.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,10 @@ export const useWordStore = defineStore("word", () => {

// 分页获取数据:从table中
function getPageFromSomeTable(table, offset, limit) {
console.log(table.value.name, "getPageFromSomeTable");
console.log(table.value?.name, "getPageFromSomeTable");
if (!table.value) {
return Promise.resolve([])
}
return table.value
.offset(offset)
.limit(limit)
Expand Down
8 changes: 4 additions & 4 deletions src/views/basicTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
basicData.currentBook
}}</el-descriptions-item>
<el-descriptions-item label="书本词汇">{{
dictWords.length
dictWords?.length
}}</el-descriptions-item>
<el-descriptions-item label="选择范围">{{
basicData.currentRange
}}</el-descriptions-item>
<el-descriptions-item label="范围词汇">{{
bookWords.length
bookWords?.length
}}</el-descriptions-item>
<el-descriptions-item label="范围可用词汇">{{
willStudyWords.length
willStudyWords?.length
}}</el-descriptions-item>
<el-descriptions-item label="范围不可用词汇">{{
notStudyWords.length
notStudyWords?.length
}}</el-descriptions-item>
</el-descriptions>
</template>
Expand Down
14 changes: 7 additions & 7 deletions src/views/todayVocabulary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<template>
<div v-loading="loading">
<h3 class="today-voca-head">
今日({{ todayDate }})背诵单词,共计:{{ todayWords.length }}个
今日({{ todayDate }})背诵单词,共计:{{ todayWords?.length }}个
<el-link @click="lookTodayVocaMore" type="primary">查看更多...</el-link>
</h3>
<TablePage
:showHandle="false"
:linkToBing="true"
:data="pageTodayWords"
:table-len="todayWords.length"
:table-len="todayWords?.length"
:items="[
{ prop: 'n', label: '单词' },
{ prop: 'count', label: '次数' },
Expand All @@ -19,14 +19,14 @@
/>

<h3 class="today-voca-head">
历史背诵单词,共计:{{ historyWords.length }}个,
历史背诵单词,共计:{{ historyWords?.length }}个,
<el-link @click="exportData" type="primary">导出数据...</el-link>
</h3>
<TablePage
:showHandle="true"
:linkToBing="true"
:data="pageHistoryWords"
:table-len="historyWords.length"
:table-len="historyWords?.length"
:items="[
{ prop: 'n', label: '单词' },
{ prop: 'count', label: '次数' },
Expand All @@ -47,13 +47,13 @@
</TablePage>

<h3 class="today-voca-head">
非范围单词,共计:{{ notStudyWords.length }}个
非范围单词,共计:{{ notStudyWords?.length }}个
</h3>
<TablePage
:showHandle="false"
:linkToBing="true"
:data="pageNotStudyWords"
:table-len="notStudyWords.length"
:table-len="notStudyWords?.length"
:items="[{ prop: 'n', label: '单词' }]"
:tablePageSize="tablePageSize"
@getData="getPageNotStudyWords"
Expand Down Expand Up @@ -117,7 +117,7 @@ function getPageHistoryWords(current, newSize) {
function getPageNotStudyWords(current, newSize) {
if (newSize) tablePageSize.value = newSize;
let start = (current - 1) * tablePageSize.value;
pageNotStudyWords.value = notStudyWords.value
pageNotStudyWords.value = (notStudyWords.value || [])
.slice(start, start + tablePageSize.value)
.map((n) => ({ n }));
}
Expand Down

0 comments on commit bd60828

Please sign in to comment.