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

vue-elementui-dialog-fun

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-elementui-dialog-fun

基于element-ui dialog组件的函数化实现

  • 0.1.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

vue-elementui-dialog-fun

插件使用说明

下载插件

npm install vue-elementui-dialog-fun

在vue 项目中引入并注册

import dialog from 'vue-elementui-dialog-fun'

Vue.use(dialog)

使用

该函数有两个参数:
    component: 是一个需要用弹窗打开的组件

    options: 一个配置选项,对象格式
            {
                title:弹窗的一级标题,
                preTitle:弹窗的二级标题,
                width:弹窗的宽度, 字符串形式 , 例: '300px',
                dialogParams: 一个对象数据,用于传递数据给弹窗组件 例: {ahe:12},  则在对应的打开的组件可以从props中取,props:['dialogParams']
            }

函数返回一个promise对象  

this.$dialog(component,options).then((res)=>{
    // 返回的数据  将弹窗的数据传递出来  res  就是  ok(params) 调用时的参数
    consloe.log(res)
})

注意事项

当使用Vue.use()注册该插件时,已经在全局混入
{
     props: ['dialogParams'],
    data(){
        return {
            model,
        }
    },
        methods: {
        //取消
        cancel() {
           
        },
        //确定
        ok(params) {
           
        },
    }
}

切勿变量冲突,

在需要打开的组件中  使用dialogParams来获取函数调用时传递过来的数据,使用 ok() 或者 cancel() 来关闭弹窗,并且ok()函数有一个参数用于返回数据

FAQs

Package last updated on 25 Dec 2021

Did you know?

Socket

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.

Install

Related posts

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