![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
image-preview-vue
Advanced tools
易于使用的PC端图片浏览组件,编程式的调用方式
npm i image-preview-vue --save
global
// main.js
import imagePreview from 'image-preview-vue'
import 'image-preview-vue/lib/imagepreviewvue.css'
Vue.use(imagePreview)
// your some.vue
export default {
// ...
methods:{
foo(){
const preview = this.$imagePreview({
initIndex:0,
images:['https://yinodimage.oss-cn-hangzhou.aliyuncs.com/20200229004202.jpg'],
})
}
}
}
import
// main.js
import 'image-preview-vue/lib/imagepreviewvue.css'
// other.js
import imagePreview from 'image-preview-vue'
const preview = imagePreview({
initIndex:0,
images:['https://yinodimage.oss-cn-hangzhou.aliyuncs.com/20200229004202.jpg'],
})
参数名 | 类型 | 描述 | 可选值 | 默认值 |
---|---|---|---|---|
initIndex | Number | 初始化展示图片索引 | - | 0 |
images | [String] | 图片URL数组 | - | [] |
isEnableBlurBackground | Boolean | 是否开启高斯模糊背景 | - | false |
maskBackgroundColor | String | 半透明遮罩层背景色 只生效于关闭高斯模糊的情况 | 任何合法的css background-color值 | 'rgba(0,0,0,0.4)' |
isEnableLoopToggle | Boolean | 是否开启循环切换模式 | - | true |
initViewMode | String | 初始化图片展示模式(等于与Object-fit) | 'contain'/'cover' | 'contain' |
containScale | Number | contain模式下的缩放比例,只在contain模式下生效 | 合法区间 [0.1,5] | 1 |
shirnkAndEnlargeDeltaRatio | Number | 缩放点击强度系数 | - | 0.2 |
wheelScrollDeltaRatio | Number | 鼠标滚轮缩放图片强度系数 | - | 0.2 |
isEnableImagePageIndicator | Boolean | 是否显示分页 | - | true |
onClose | Function | 关闭回调 | - | ()=>{} |
zIndex | Number | 预览弹窗的 z-index 值 | - | 100 |
isEnableKeyboardShortcuts | Boolean | 是否开启常用快捷键 | - | false |
isEnableDownloadImage | Boolean | 是否开启图片下载功能 | - | true |
getImageFileName | Function | 下载时图片的文件名获取函数,可以自己实现正则来获取文件名,默认是时间戳 | - | (url) => String(Date.now()) |
viewMode
内置两个基本模式 contain
和 cover
对应下方全屏切换按钮
快捷键 shortcuts
get instance
const preview = this.$imagePreview({...})
方法名 | 参数 | 描述 |
---|---|---|
close | - | 关闭预览 |
如果有发现bug或者希望加入一些功能,请积极提issues,我会尽快回复
MIT
灵感来自ElementUI中的Image组件,但是可惜没有编程式的调用方式,所以催生了这个库
FAQs
a images viewer for vue.js / 基于Vue.js的图片预览查看器 编程式使用
The npm package image-preview-vue receives a total of 168 weekly downloads. As such, image-preview-vue popularity was classified as not popular.
We found that image-preview-vue 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.