Skip to content

Commit

Permalink
修复fs模块报错问题
Browse files Browse the repository at this point in the history
  • Loading branch information
qq861366490 committed Sep 24, 2019
1 parent 395227b commit c8da454
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 25 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules

package-lock.json
package-lock.json

pdf
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# pdfh5.js v1.2.17
# pdfh5.js v1.2.18

[![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)

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

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

- [pdfh5项目GitHub地址](https://github.com/gjTool/pdfh5)

- [pdfh5打包下载](http://www.gjtool.cn/download/pdfh5.zip)

![pdfh5.js示例](https://img-blog.csdnimg.cn/20190731133403792.gif)

## 更新信息

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


### pdfh5在线预览 (建议使用谷歌浏览器F12手机模式打开预览)
Expand Down
16 changes: 8 additions & 8 deletions example/pdfh5-vue/build/webpack.base.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ module.exports = {
node: {
// prevent webpack from injecting useless setImmediate polyfill because Vue
// source contains it (although only uses it if it's native).
setImmediate: false,
// prevent webpack from injecting mocks to Node native modules
// that does not make sense for the client
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
// setImmediate: false,
// // prevent webpack from injecting mocks to Node native modules
// // that does not make sense for the client
// dgram: 'empty',
// fs: 'empty',
// net: 'empty',
// tls: 'empty',
// child_process: 'empty'
}
}
2 changes: 1 addition & 1 deletion example/pdfh5-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build": "node build/build.js"
},
"dependencies": {
"pdfh5": "^1.2.17",
"pdfh5": "^1.2.18",
"vue": "^2.5.2"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions example/test/js/pdf.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/test/js/pdfh5.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/pdf.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/pdfh5.js

Large diffs are not rendered by default.

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

0 comments on commit c8da454

Please sign in to comment.