Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
pic-viewer
Advanced tools
viewerjs
的 vue 版本 增加了预览前的外部展示 使其开箱即用Dependencies:vue
// 全局引入
import 'pic-viewer/dist/style.css'
import PicViewer from 'pic-viewer'
Vue.use(PicViewer, {
// 全局配置
})
<!-- 局部引入 -->
<template>
<PicViewer v-bind="config"/>
</template>
<script>
import 'pic-viewer/dist/style.css'
import PicViewer from 'pic-viewer'
export default {
components: { PicViewer },
data () {
return {
config: {
// 局部配置
}
}
}
}
</script>
Attribute | Description | Type | Options | Default |
---|---|---|---|---|
value | img link(s) | string / array[string] / array[object] | ||
pattern | display pattern | string | 'waterfall', 'swiper', 'table-cell' | undefined, means normal flow |
viewerjs | indicate if enable viewerjs or not | boolean | true | |
viewerjsProps* | props of viewerjs | object | ||
objectKey | if type of value is array[object], you need to specify the img key of object | string | ||
swiperProps* | props of swiper | object | ||
qrcode* | turning value into qrcode | boolean, string | true, false, 'auto' | false |
qrcodeProps* | props of qrcode dependency | object |
::: tip
如果将 qrcode 设为 'auto',pic-viewer 会自动判断是否需要转换(value 为 base64 或 url 时不会转换)
:::
// 默认值
{
zIndex: 5000,
}
// 默认值
{
margin: 0,
errorCorrectionLevel: 'L',
width: 444,
height: 444,
}
// 默认值
{
observer: true,
}
权重:
Name | Description | Callback's arguments |
---|---|---|
click | 点击图片后触发 | { src, index } |
Name | Description |
---|---|
默认插槽 | 自定义img标签 |
<!-- 示例 -->
<PicViewer>
<template v-slot="{ src, index }">
<img :src="src" alt="">
<div>第{{ index + 1 }}张</div>
</template>
</PicViewer>
Method | Description | Parameters |
---|---|---|
preview | preview manually | index of value array (default: 0) |
Preview manually, no external display
<PicViewer :value="" v-show="false" ref="PicViewer"/>
<button @click="()=>{$refs.PicViewer.preview(6)}">preview</button>
默认图片的style高度为148px(与 el-upload
保持一致),而qrcode的分辨率为 444×444
(三倍图),如果你修改了样式,增大了宽高,可能导致图片模糊
<PicViewer :qrcodeProps="{
width: 1000,
height: 1000
}"/>
<template>
<PicViewer pattern="swiper" ref="picViewer" :swiperProps="{
on: {
init: onSwiperInit,
},
}"/>
</template>
<script>
import 'pic-viewer/dist/style.css'
import PicViewer from 'pic-viewer'
export default {
components: { PicViewer },
data () {
return {
swiper: null
}
},
methods: {
onSwiperInit () {
this.$nextTick(() => {
this.swiper = this.$refs.picViewer.swiper
})
}
}
}
</script>
FAQs
Picture viewer.
The npm package pic-viewer receives a total of 6 weekly downloads. As such, pic-viewer popularity was classified as not popular.
We found that pic-viewer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.