输出各阶段的时间

This commit is contained in:
Donal 2020-09-22 14:10:03 +08:00
parent 51a1bae945
commit 72857cc74e
2 changed files with 11 additions and 0 deletions

View File

@ -294,13 +294,21 @@ export default {
getOfdDocumentObj(file, screenWidth) {
let that = this;
let t = new Date().getTime();
parseOfdDocument({
ofd: file,
success(res) {
let t1 = new Date().getTime();
console.log('解析ofd',t1 - t);
console.log(res);
that.ofdObj = res;
that.pageCount = res.pages.length;
const divs = renderOfd(screenWidth, res);
let t2 = new Date().getTime();
console.log('xml转svg', t2 - t1)
that.displayOfdDiv(divs);
let t3 = new Date().getTime();
console.log('svg渲染到页面', t3 - t2)
},
fail(error) {
console.log(error)

View File

@ -61,6 +61,9 @@ export const renderOfd = function (screenWidth, ofd) {
export const renderOfdByScale = function (ofd) {
let divArray = [];
if (!ofd) {
return divArray;
}
for (const page of ofd.pages) {
let box = calPageBoxScale(ofd.document, page);
const pageId = Object.keys(page)[0];