Доделки SearchPage

This commit is contained in:
Book Pauk
2019-02-02 18:22:00 +07:00
parent f74f44822e
commit 0276bcb8b3

View File

@@ -61,34 +61,38 @@ class SearchPage extends Vue {
} }
async init(parsed) { async init(parsed) {
this.parsed = parsed; if (this.parsed != parsed) {
this.initStep = true;
this.stopInit = false;
this.header = 'Подготовка';
await this.$nextTick();
this.initStep = true; let prevPerc = 0;
this.stopInit = false; let text = '';
this.header = 'Подготовка'; for (let i = 0; i < parsed.para.length; i++) {
await this.$nextTick(); const p = parsed.para[i];
const parts = parsed.splitToStyle(p.text);
if (this.stopInit)
break;
let prevPerc = 0; for (const part of parts)
let text = ''; text += part.text;
for (let i = 0; i < parsed.para.length; i++) {
const p = parsed.para[i];
const parts = parsed.splitToStyle(p.text);
if (this.stopInit)
break;
for (const part of parts) const perc = Math.round(i/parsed.para.length*100);
text += part.text;
const perc = Math.round(i/parsed.para.length*100); if (perc != prevPerc) {
this.initPercentage = perc;
if (perc != prevPerc) { await sleep(1);
this.initPercentage = perc; prevPerc = perc;
await sleep(1); }
prevPerc = perc;
} }
this.text = text.toLowerCase();
this.initStep = false;
this.needle = '';
this.foundList = [];
this.foundCur = -1;
this.parsed = parsed;
} }
this.text = text.toLowerCase();
this.initStep = false;
this.header = 'Найти'; this.header = 'Найти';
await this.$nextTick(); await this.$nextTick();