
Security News
The Code You Didn't Write Is Still Yours to Defend
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.
@heisea/viewer
Advanced tools
基于vue2的资源预览控件,支持放大、缩小、旋转、拖拽,支持远程图片预览、调起下载、打印,支持多图预览。
v0.2.8
v0.2.6
patch-package依赖包。v0.2.5
v0.2.4
v0.2.3
@heisea/viewer/lib/vendors~pdfjsWorker.common.jsv0.2.2
v0.2.1
@heisea/viewer/lib/vendors~pdfjsWorker.common.jsvue.use(Viewer,options),单独使用组件时不生效。v0.2.0
v0.1.1
downloadFN允许自定义下载方法v0.1.0
进行开发
npm start
打包出生产版本 commonjs 版本
npm run build:common
npm version <newversion> | major | minor | patch]
npm publish
npm i @heisea/viewer
import Viewer from '@heisea/viewer'
Vue.use(Viewer,{
props: {
fileId: 'id',
fileName: 'originalFileName',
fileSuffix: 'ext',
fileUrl: 'url',
data: 'data'
},
http: {
filePath: 'http://hxgw.heisea.cn/base/fe/info'
},
fetch
}); // 当前组件
Vue.prototype.$fetch = fetch; // 当传参数时会调用当前获得文件
注意pdf预览,必须设置拷贝字体资源文件夹cmaps 到根目录
new CopyWebpackPlugin({
patterns: [
{
from: path.resolve(__dirname, '../node_modules/@heisea/viewer/lib/cmaps/'),
to: path.resolve(__dirname, '../dist/cmaps/')
}]
}),
1.当组件使用
<template>
<img-viewer v-bind="cfg" />
</template>
<script>
export default {
data() {
return {
cfg: {
mode: 'img',
value: 'http://bucket-cert-test.oss-cn-shanghai.aliyuncs.com/2019/10/51df3ed3-fa5f-4334-9963-6767fe63aa06.jpg'
},
};
}
};
</script>
2.函数调用 this.$viewer({value:url,options}) 支持单独配置配置当前预览器
// 直接打开图片
this.$viewer('http://bucket-cert-test.oss-cn-shanghai.aliyuncs.com/2019/10/51df3ed3-fa5f-4334-9963-6767fe63aa06.jpg');
// 直接打开id对应的资源
this.$viewer('1182133098524016641,1182222336212881410');
| 属性名 | 类型 | 说明 |
|---|---|---|
| mode | String | 显示状态node:不显示,btn:按钮,img:图片 |
| value | Auto | 显示的内容object:作为资源对象,Array:多个资源对象,String:资源地址(支持用‘,’分割多个) |
| btnLabel | String、Function | mode:btn时使用修改显示内容,默认:“查看文件”,同时支持直接 |
| http | Object | 请求配置,必须配置$fetch |
| http.filePath | String | 文件请求地址 |
| props | Object | 配置字段 |
| extend | Object | 站位节点属性配置 |
| downloadFN | Function | 自定义资源下载逻辑(url,fileName) |
FAQs
Vue solution for quickly building pages
The npm package @heisea/viewer receives a total of 8 weekly downloads. As such, @heisea/viewer popularity was classified as not popular.
We found that @heisea/viewer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.