Skip to content

Commit c8da454

Browse files
committed
修复fs模块报错问题
1 parent 395227b commit c8da454

File tree

9 files changed

+33
-25
lines changed

9 files changed

+33
-25
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
node_modules
22

3-
package-lock.json
3+
package-lock.json
4+
5+
pdf

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
# pdfh5.js v1.2.17
1+
# pdfh5.js v1.2.18
22

33
[![npm version](https://img.shields.io/npm/v/pdfh5.svg)](https://www.npmjs.com/package/pdfh5) [![npm downloads](https://img.shields.io/npm/dt/pdfh5.svg)](https://www.npmjs.com/package/pdfh5) [![MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/gjTool/pdfh5/blob/master/LICENSE) [![GitHub issues](https://img.shields.io/github/issues/gjTool/pdfh5.svg)](https://github.com/gjTool/pdfh5/issues) [![GitHub stars](https://img.shields.io/github/stars/gjTool/pdfh5.svg?style=social)](https://github.com/gjTool/pdfh5/stargazers) [![GitHub forks](https://img.shields.io/github/forks/gjTool/pdfh5.svg?style=social)](https://github.com/gjTool/pdfh5/network/members)
44

55
**pdfh5.js 基于pdf.js和jQuery,web/h5/移动端PDF预览手势缩放插件。支持canvas和svg两种渲染模式,支持ajax和fetch两种请求方式。支持懒加载。**
66

77
- 前端学习交流QQ群,651601340,可以进来提pdfh5.js的bug、问题、建议等。
88

9+
- [pdfh5项目GitHub地址](https://github.com/gjTool/pdfh5)
10+
11+
- [pdfh5打包下载](http://www.gjtool.cn/download/pdfh5.zip)
12+
913
![pdfh5.js示例](https://img-blog.csdnimg.cn/20190731133403792.gif)
1014

1115
## 更新信息
1216

13-
- 2019.09.16更新: 1.更新pdf.js版本至官网v2.1.266。2.修改重复在同一个div容器里渲染pdf时不会刷新pdf的问题
17+
- 2019.09.19更新: 1.更新一个小问题(pdf.js引用了fs模块,但实际上浏览器环境没有用到fs,配置文件就没有安装fs,导致找不到fs报错。vue-cli2.0本身已避免这个问题了,但是还是有很多人重复出现这个问题,也不去看issue解决办法。所以我动手更新一下吧)
1418

1519

1620
### pdfh5在线预览 (建议使用谷歌浏览器F12手机模式打开预览)

example/pdfh5-vue/build/webpack.base.conf.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ module.exports = {
7070
node: {
7171
// prevent webpack from injecting useless setImmediate polyfill because Vue
7272
// source contains it (although only uses it if it's native).
73-
setImmediate: false,
74-
// prevent webpack from injecting mocks to Node native modules
75-
// that does not make sense for the client
76-
dgram: 'empty',
77-
fs: 'empty',
78-
net: 'empty',
79-
tls: 'empty',
80-
child_process: 'empty'
73+
// setImmediate: false,
74+
// // prevent webpack from injecting mocks to Node native modules
75+
// // that does not make sense for the client
76+
// dgram: 'empty',
77+
// fs: 'empty',
78+
// net: 'empty',
79+
// tls: 'empty',
80+
// child_process: 'empty'
8181
}
8282
}

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.17",
13+
"pdfh5": "^1.2.18",
1414
"vue": "^2.5.2"
1515
},
1616
"devDependencies": {

example/test/js/pdf.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/test/js/pdfh5.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/pdf.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/pdfh5.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pdf.html

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,16 @@
3232
//当前默认优先获取浏览器地址栏?file=后面的地址,如果地址栏没有,再拿配置项的pdfurl或者data来渲染pdf
3333
//优先顺序: ?file= > pdfurl > data
3434
var pdfh5 = new Pdfh5('#demo', {
35-
pdfurl: "//www.gjtool.cn/pdfh5/git.pdf"
35+
pdfurl: "http://www.gjtool.cn/pdfh5/test.pdf"
3636
});
37-
// window.onorientationchange = function () {
38-
// pdfh5.destroy()
39-
// setTimeout(() => {
40-
// pdfh5.init(pdfh5.options)
41-
// }, 2000);
42-
// }
37+
// setTimeout(() => {
38+
// var pdfh5 = new Pdfh5('#demo', {
39+
// pdfurl: "http://www.gjtool.cn/pdfh5/git.pdf"
40+
// });
41+
// pdfh5.on("complete", function (status, msg, time) {
42+
// console.log("状态:" + status + ",信息:" + msg + ",耗时:" + time + "毫秒,总页数:" + this.totalNum)
43+
// })
44+
// }, 5000);
4345
//配置项参数 type:"ajax" 请求方式为ajax,默认fetch
4446
// var pdfh5 = new Pdfh5('#demo', {
4547
// pdfurl: "./default.pdf",

0 commit comments

Comments
 (0)