Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hevue-img-preview

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hevue-img-preview - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

9

package.json
{
"name": "hevue-img-preview",
"description": "基于vue.js的图片预览组件",
"version": "0.0.3",
"description": "一个基于vue的图片预览组件",
"version": "0.0.4",
"author": "贺永胜 <1378431028@qq.com>",
"license": "MIT",
"private": false,
"main": "dist/vue-toast-c.js",
"repository": {
"type": "git",
"url": "https://github.com/heyongsheng/hevue-img-preview"
},
"scripts": {

@@ -9,0 +14,0 @@ "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",

# hevue-img-preview
> 基于vue.js的图片预览组件
> 一个基于vue的图片预览组件

@@ -5,0 +5,0 @@ ## Build Setup

@@ -1,15 +0,65 @@

import vueImgPreview from './hevue-img-preview.vue' // 导入组件
const paykeyboard = {
install (Vue, options) {
Vue.component(vueImgPreview.name, vueImgPreview) // vuePayKeyboard.name 组件的name属性
// 类似通过 this.$xxx 方式调用插件的 其实只是挂载到原型上而已
// Vue.prototype.$xxx // 最终可以在任何地方通过 this.$xxx 调用
// 虽然没有明确规定用$开头 但是大家都默认遵守这个规定
import Vue from 'vue'
import VueToast from './hevue-img-preview.vue'
const ToastConstructor = Vue.extend(VueToast)
const instance = new ToastConstructor().$mount()
const pageScroll = (() => {
const fn = (e) => {
let evt = e || window.event
evt.preventDefault()
evt.stopPropagation()
}
let islock = false
return {
lock (el) {
if (islock) return
islock = true;
(el || document).addEventListener('mousewheel', fn);
(el || document).addEventListener('touchmove', fn)
},
unlock (el) {
islock = false;
(el || document).removeEventListener('mousewheel', fn);
(el || document).removeEventListener('touchmove', fn)
}
}
})()
ToastConstructor.prototype.closeToast = function () {
const el = instance.$el
el.parentNode && el.parentNode.removeChild(el)
//恢复滚动
pageScroll.unlock()
typeof this.callback === 'function' && this.callback()
}
// 新增
const Toast = (options = {}) => {
instance.mes = options.mes || '正在开发中……'
instance.timeout = ~~options.timeout || 2000
instance.callback = options.callback
document.body.appendChild(instance.$el)
//禁止滚动
pageScroll.lock()
// 定时关闭
const timer = setTimeout(() => {
clearTimeout(timer)
instance.closeToast()
}, instance.timeout + 100)
}
const install = (Vue) => {
Vue.prototype.$hevueImgPreview = Toast
}
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(paykeyboard)
window.Vue.use(install)
}
export default paykeyboard // 导出
export default install
import Vue from 'vue'
import App from './App.vue'
import hevueImgPreview from './lib/index.js'
Vue.use(hevueImgPreview)
new Vue({

@@ -5,0 +8,0 @@ el: '#app',

@@ -11,2 +11,3 @@ var path = require('path')

filename: 'hevue-img-preview.js',
library: 'hevueImgPreview',
libraryTarget: 'umd',

@@ -13,0 +14,0 @@ umdNamedDefine: true

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc