
Security News
Suno Breached via Shai-Hulud Worm, Leaked Code Exposes AI Music Scraping
A Shai-Hulud infection exposed Suno's source code, which shows the AI music startup stream-ripped tracks to train its models.
vue-photo-preview
Advanced tools
"基于photoswipe的vue图片预览插件"
1.简化了photoswipe的默认设置
2.取消了图片需设定尺寸的要求
3.默认关闭了分享按钮
4.简化了html结构
# 安装
npm install vue-photo-preview --save
# 引入
import preview from 'vue-photo-preview'
import 'vue-photo-preview/dist/skin.css'
Vue.use(preview)
//或者
//var option={....} option配置请查看 http://photoswipe.com/documentation/options.html
//Vue.use(preview,option)
# umd
<link rel="stylesheet" type="text/css" href="路径/dist/skin.css"/>
<script src="路径/dist/vue-photo-preview.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var options={
fullscreenEl:false //关闭全屏按钮
}
Vue.use(vuePhotoPreview,options)
new Vue({
el:'#app'
})
</script>
# html
//在img标签添加preview属性 preview值相同即表示为同一组
<img src="xxx.jpg" preview="0" preview-text="描述文字">
//分组
<img src="xxx.jpg" preview="1" preview-text="描述文字">
<img src="xxx.jpg" preview="1" preview-text="描述文字">
<img src="xxx.jpg" preview="2" preview-text="描述文字">
<img src="xxx.jpg" preview="2" preview-text="描述文字">
<img src="xxx.jpg" large="xxx_3x.jpg" preview="2" preview-text="缩略图与大图模式">
修复打开和关闭图片页面时,动画起始位置总是位于图片组最后一张的问题。调整默认点击放大倍数。
解决图片多次点击问题。缩略图只可点击一次,直至图片加载完成后,才可再次打开。
重命名this.init为this.initPreview,解决部分冲突问题。 去除所有console打印
解决原图与大图模式下的BUG
//添加对原插件photoswipe的事件响应,示例:
this.$preview.on('close',())=>{//close只是众多事件名的其中一个,更多请查看文档
console.log('图片查看器被关闭')
})
//添加图片查看器实例--this.$preview.self 注意:此实例仅在图片查看器被打开时生效
this.$preview.on('imageLoadComplete',(e,item)=>{
console.log(this.$preview.self) //此时this.$preview.self拥有原插件photoswipe文档中的所有方法和属性
})
//demo文件夹中index.html可以供参考写法 //本次更新后继承了原插件的所有事件、方法和属性,如需复杂使用请多多查看原插件文档
//应性能要求 新增大图查看 large标签填写大图路径 (插件的思路是 img的src默认为缩略图),如不填写large,则展示src
<img src="xxx.jpg" large="xxx_3x.jpg" preview="2" preview-text="描述文字">
//如果图片是异步生成的,在图片数据更新后调用:
this.$previewRefresh()
FAQs
"基于photoswipe的vue图片预览组件"
The npm package vue-photo-preview receives a total of 693 weekly downloads. As such, vue-photo-preview popularity was classified as not popular.
We found that vue-photo-preview demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
A Shai-Hulud infection exposed Suno's source code, which shows the AI music startup stream-ripped tracks to train its models.

Security News
Vercel is formalizing a monthly release program for Next.js. The change follows React2Shell and a sharp rise in AI-assisted vulnerability discovery.

Research
/Security News
11 malicious NuGet tools pose as game cheats to deploy Windows payloads, track hosts, and use Google Sheets for telemetry and control.