Optimize Loading

remotes/origin/HEAD
MengYX 5 years ago
parent f99e885d9f
commit cc8e818142
No known key found for this signature in database
GPG Key ID: E63F9C7303E8F604

@ -10,18 +10,17 @@
</el-image>
</template>
</el-table-column>
<!--todo: Check sortable-->
<el-table-column label="歌曲" sortable>
<el-table-column label="歌曲">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.title }}</span>
</template>
</el-table-column>
<el-table-column label="歌手" sortable>
<el-table-column label="歌手">
<template slot-scope="scope">
<p>{{ scope.row.artist }}</p>
</template>
</el-table-column>
<el-table-column label="专辑" sortable>
<el-table-column label="专辑">
<template slot-scope="scope">
<p>{{ scope.row.album }}</p>
</template>

@ -27,14 +27,19 @@
},
mounted() {
if (document.location.host !== "" && process.env.NODE_ENV === 'production') {
const worker = require("workerize-loader!../decrypt/common");
this.thread_num = navigator.hardwareConcurrency || 1;
for (let i = 0; i < this.thread_num; i++) {
//todo: Optimize for first loading
const worker = require("workerize-loader!../decrypt/common");
// noinspection JSValidateTypes,JSUnresolvedVariable
this.workers.push(worker().CommonDecrypt);
this.idle_workers.push(0);
// delay to optimize for first loading
setTimeout(() => {
for (let i = 1; i < this.thread_num; i++) {
// noinspection JSValidateTypes,JSUnresolvedVariable
this.workers.push(worker().CommonDecrypt);
this.idle_workers.push(i);
}
}, 1000);
} else {
const dec = require('../decrypt/common');
this.workers.push(dec.CommonDecrypt);

Loading…
Cancel
Save