Skip to content

Commit 62960f3

Browse files
committed
修复懒加载时横竖屏比例
1 parent 517f96d commit 62960f3

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

example/pdfh5-vue/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"build": "node build/build.js"
1111
},
1212
"dependencies": {
13-
"pdfh5": "^1.2.12",
13+
"pdfh5": "^1.2.13",
1414
"vue": "^2.5.2"
1515
},
1616
"devDependencies": {

example/test/js/pdfh5.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; (function (g, fn) {
2-
var version = "1.2.12";
2+
var version = "1.2.13";
33
console.log("The latest version and API of pdfh5 from: https://github.com/gjTool/pdfh5 (pdfh5.js: " + version + ")")
44
if (typeof require !== 'undefined') {
55
if (g.$ === undefined) {
@@ -1095,6 +1095,9 @@
10951095
width: num * self.loadedCount + "%"
10961096
})
10971097
}
1098+
$(container).css({
1099+
"min-height": $(svg).height() + 'px'
1100+
}).attr("data-height", $(svg).height())
10981101
var time = new Date().getTime();
10991102
var arr1 = self.eventType["render"];
11001103
if (arr1 && arr1 instanceof Array) {
@@ -1159,6 +1162,12 @@
11591162
obj2.src = obj2.canvas.toDataURL("image/jpeg");
11601163
img.src = obj2.src;
11611164
container.appendChild(img);
1165+
img.onload = function(){
1166+
$(container).css({
1167+
"min-height": img.height + 'px'
1168+
}).attr("data-height", img.height)
1169+
}
1170+
11621171
var time = new Date().getTime();
11631172
var arr1 = self.eventType["render"];
11641173
if (arr1 && arr1 instanceof Array) {
@@ -1225,6 +1234,7 @@
12251234
self.pages.css({
12261235
"min-height": height + 'px'
12271236
})
1237+
console.log(height)
12281238
} else {
12291239
self.pages.css({
12301240
"min-height": 'auto'
@@ -1235,6 +1245,7 @@
12351245
self.pages.css({
12361246
"min-height": h + 'px'
12371247
})
1248+
console.log(h)
12381249
}, 0)
12391250
}
12401251
})

js/pdfh5.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; (function (g, fn) {
2-
var version = "1.2.12";
2+
var version = "1.2.13";
33
console.log("The latest version and API of pdfh5 from: https://github.com/gjTool/pdfh5 (pdfh5.js: " + version + ")")
44
if (typeof require !== 'undefined') {
55
if (g.$ === undefined) {
@@ -1095,6 +1095,9 @@
10951095
width: num * self.loadedCount + "%"
10961096
})
10971097
}
1098+
$(container).css({
1099+
"min-height": $(svg).height() + 'px'
1100+
}).attr("data-height", $(svg).height())
10981101
var time = new Date().getTime();
10991102
var arr1 = self.eventType["render"];
11001103
if (arr1 && arr1 instanceof Array) {
@@ -1159,6 +1162,12 @@
11591162
obj2.src = obj2.canvas.toDataURL("image/jpeg");
11601163
img.src = obj2.src;
11611164
container.appendChild(img);
1165+
img.onload = function(){
1166+
$(container).css({
1167+
"min-height": img.height + 'px'
1168+
}).attr("data-height", img.height)
1169+
}
1170+
11621171
var time = new Date().getTime();
11631172
var arr1 = self.eventType["render"];
11641173
if (arr1 && arr1 instanceof Array) {
@@ -1225,6 +1234,7 @@
12251234
self.pages.css({
12261235
"min-height": height + 'px'
12271236
})
1237+
console.log(height)
12281238
} else {
12291239
self.pages.css({
12301240
"min-height": 'auto'
@@ -1235,6 +1245,7 @@
12351245
self.pages.css({
12361246
"min-height": h + 'px'
12371247
})
1248+
console.log(h)
12381249
}, 0)
12391250
}
12401251
})

0 commit comments

Comments
 (0)