New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

v-dialogs

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

v-dialogs - npm Package Compare versions

Comparing version 1.10.0 to 2.0.0

src/components/Alert.vue

10

package.json
{
"name": "v-dialogs",
"description": "A simple and powful dialog, dialog type including Modal, Alert, Mask and Toast, based on Vue2.x",
"version": "1.10.0",
"version": "2.0.0",
"author": "TerryZ <terry5@foxmail.com>",

@@ -30,3 +30,3 @@ "license": "MIT",

"dependencies": {
"vue": "^2.5.11"
"vue": "^2.5.21"
},

@@ -46,9 +46,9 @@ "browserslist": [

"file-loader": "^1.1.4",
"node-sass": "^4.5.3",
"node-sass": "^4.11.0",
"sass-loader": "^6.0.6",
"vue-loader": "^13.0.5",
"vue-template-compiler": "^2.4.4",
"vue-template-compiler": "^2.5.21",
"webpack": "^3.6.0",
"webpack-dev-server": "^2.9.1"
}
}
}
# v-dialogs
A simple and powerful dialog, dialog type including **Modal**, **Alert**, **Mask** and **Toast**, based on **Vue2.x**
A simple and powerful dialog for **Vue2**, dialog type including **Modal**, **Alert**, **Mask** and **Toast**
[![npm version](https://img.shields.io/npm/v/v-dialogs.svg)](https://www.npmjs.com/package/v-dialogs)
[![license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://mit-license.org/)
[![npm](https://img.shields.io/npm/dy/v-dialogs.svg)](https://www.npmjs.com/package/v-dialogs)
<br><br>
## Demo、Document、Changelog
## Demos and Documents
Explorer on
- [English official site](https://terryz.github.io/vue)
- [中文官网](https://terryz.gitee.io/vue)
- [English site](https://terryz.github.io/vue/#/dialog)
- [国内站点](https://terryz.gitee.io/vue/#/dialog)
the jQuery version: [bDialog](https://github.com/TerryZ/bDialog)
The jQuery version: [bDialog](https://github.com/TerryZ/bDialog)
<br><br>
## State
[![npm version](https://img.shields.io/npm/v/v-dialogs.svg)](https://www.npmjs.com/package/v-dialogs)
[![license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://mit-license.org/)
[![npm](https://img.shields.io/npm/dy/v-dialogs.svg)](https://www.npmjs.com/package/v-dialogs)
### The Dialog Icon

@@ -29,6 +27,25 @@

<br><br>
## Vue plugin series
| Plugin | Status | Description |
| :---------------- | :-- | :-- |
| [v-page](https://github.com/TerryZ/v-page) | [![npm version](https://img.shields.io/npm/v/v-page.svg)](https://www.npmjs.com/package/v-page) | A simple pagination bar, including length Menu, i18n support |
| [v-dialogs](https://github.com/TerryZ/v-dialogs) | [![npm version](https://img.shields.io/npm/v/v-dialogs.svg)](https://www.npmjs.com/package/v-dialogs) | A simple and powerful dialog, including Modal, Alert, Mask and Toast modes |
| [v-tablegrid](https://github.com/TerryZ/v-tablegrid) | [![npm version](https://img.shields.io/npm/v/v-tablegrid.svg)](https://www.npmjs.com/package/v-tablegrid) | A simpler to use and practical datatable |
| [v-uploader](https://github.com/TerryZ/v-uploader) | [![npm version](https://img.shields.io/npm/v/v-uploader.svg)](https://www.npmjs.com/package/v-uploader) | A Vue2 plugin to make files upload simple and easier, <br>you can drag files or select file in dialog to upload |
| [v-ztree](https://github.com/TerryZ/v-ztree) | [![npm version](https://img.shields.io/npm/v/v-ztree.svg)](https://www.npmjs.com/package/v-ztree) | A simple tree for Vue2, support single or multiple(check) select tree, <br>and support server side data |
| [v-gallery](https://github.com/TerryZ/v-gallery) | [![npm version](https://img.shields.io/npm/v/v-gallery.svg)](https://www.npmjs.com/package/v-gallery) | A Vue2 plugin make browsing images in gallery |
| [v-region](https://github.com/TerryZ/v-region) | [![npm version](https://img.shields.io/npm/v/v-region.svg)](https://www.npmjs.com/package/v-region) | A simple region selector, provide Chinese administrative division data |
| [v-selectpage](https://github.com/TerryZ/v-selectpage) | [![npm version](https://img.shields.io/npm/v/v-selectpage.svg)](https://www.npmjs.com/package/v-selectpage) | A powerful selector for Vue2, list or table view of pagination, <br>use tags for multiple selection, i18n and server side resources supports |
| [v-suggest](https://github.com/TerryZ/v-suggest) | [![npm version](https://img.shields.io/npm/v/v-suggest.svg)](https://www.npmjs.com/package/v-suggest) | A Vue2 plugin for input suggestions by autocomplete |
| [v-playback](https://github.com/TerryZ/v-playback) | [![npm version](https://img.shields.io/npm/v/v-playback.svg)](https://www.npmjs.com/package/v-playback) | A Vue2 plugin to make video play easier |
| [v-selectmenu](https://github.com/TerryZ/v-selectmenu) | [![npm version](https://img.shields.io/npm/v/v-selectmenu.svg)](https://www.npmjs.com/package/v-selectmenu) | A simple, easier and highly customized menu solution |
<br><br>
## Install
``` bash
# install dependencies
npm i v-dialogs --save

@@ -42,7 +59,7 @@ ```

import vDialog from 'v-dialogs';
...
Vue.use(vDialog);
```
<br><br>
## Use case

@@ -163,3 +180,3 @@

<p align="center"><img src="https://terryz.github.io/image/v-dialogs/v-dialogs-toast.png" alt="v-dialogs-toast" height="322px"></p>
<p align="right"><img src="https://terryz.github.io/image/v-dialogs/v-dialogs-toast.png" alt="v-dialogs-toast" height="322px"></p>

@@ -166,0 +183,0 @@ open a Toast dialog in a corner

/**
* v-dialogs
*/
import vDialog from './DialogContainer';
import vDialog from './vDialogContainer';
const Plugin = {
install(Vue, options = {}){
let Dialog = Vue.component(vDialog.name, vDialog);
let dlg = new Dialog();
let vm = dlg.$mount();
document.querySelector('body').appendChild(vm.$el);
const Dialog = Vue.component(vDialog.name, vDialog), dlg = new Dialog();
document.body.appendChild(dlg.$mount().$el);
//dlg.$mount();
Vue.prototype.$vDialog = {
const mergeParams = (p)=>{
const params = {};
params.language = typeof(options.language) === 'string' ? options.language : 'cn';
if(typeof(options.dialogCloseButton) === 'boolean') params.dialogCloseButton = options.dialogCloseButton;
if(typeof(options.dialogMaxButton) === 'boolean') params.dialogMaxButton = options.dialogMaxButton;
return Object.assign({}, params, p);
}, paramSet = args => {
const msg = args[0];
let params = {};
if(args.length === 3) params = args[2];
else if(args.length === 2 && typeof args[1] === 'object') params = args[1];
params = mergeParams(params);
params.message = msg;
if(args.length === 2 && typeof args[1] === 'function') params.callback = args[1];
return params;
}, instanceName = options.instanceName ? options.instanceName : '$dlg';
Vue.prototype[instanceName] = {
modal(component, params = {}){
if(!component) return;
params = mergeParams(params);
params.component = component;
return dlg.addModal(params);
},
alert(msg, callback, params = {}){
if(!msg) return;
params.message = msg;
params.callback = callback;
return dlg.addAlert(params);
/**
* Open a Alert dialog
*
* @param message[string](required)
* @param callback[function](optional)
* @param params[object](optional)
* @returns dialog key[string]
*
* //open a information type Alert dialog
* this.$dlg.alert('some message...')
* //open a information type Alert dialog and do something after dialog close
* this.$dlg.alert('some message...', ()=>{ do something... })
* //open a Alert dialog with options
* this.$dlg.alert('some message...', { messageType: 'error' })
* //open a Alert dialog with callback and options
* this.$dlg.alert('some message...', ()=>{ do something... }, { messageType: 'error' })
*/
alert(){
if(!arguments.length || !arguments[0]) return;
return dlg.addAlert(paramSet(arguments));
},
mask(msg, callback, params = {}){
params.message = msg;
params.callback = callback;
return dlg.addMask(params);
mask(){
return dlg.addMask(paramSet(arguments));
},
toast(msg, callback, params = {}){
if(!msg) return;
params.message = msg;
params.callback = callback;
return dlg.addToast(params);
toast(){
if(!arguments.length || !arguments[0]) return;
return dlg.addToast(paramSet(arguments));
},
close(data, key){
dlg.close(data, key);
close(key){
dlg.close(key);
},

@@ -41,0 +67,0 @@ closeAll(callback){

@@ -0,0 +0,0 @@ var path = require('path')

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 too big to display

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