vue 模态框组件_具有单个组件的Vue模态

vue 模态框组件

Vuedals (Vuedals)

VueJS (2.x) Plugin for multiple modals windows with a single component instance.

VueJS(2.x)插件,用于具有单个组件实例的多个模态窗口。

这是什么? (What is this?)

A plugin to open stocked modals windows, event based, with just one component in your DOM.

一个插件,用于基于事件打开库存的模态窗口,而DOM中只有一个组件。

“仅一个组件”是什么意思? (What do you mean with "just one component"?)

e.g. if you want to have 3 modals, you don't need to add the component 3 times, just one (preferably in the root of your app) and open as many modals as you want by using an Event Bus

例如,如果您想拥有3个模态,则不需要添加3次组件,只需添加一次(最好在应用程序的根目录中),并使用事件总线打开所需数量的模态

安装 (Install)

Install with npm:

使用npm安装:

npm install --save vuedals

(Example)

import Vue from 'vue';
import {default as Vuedals, Component as Vuedal, Bus as VuedalsBus} from 'vuedals';

Vue.use(Vuedals);

var myComp = Vue.extend({
    template: `<div>
            <h1>Hello World!</h1>
            <button @click="showIt()">Show me the money</button>
        </div>`,

    methods: {
        showIt() {
            VuedalsBus.$emit('new', {
                name: 'showing-the-money',

                component: {
                    name: 'the-money',

                    template: `
                        <div>
                            <h1>THE MONEY!</h1>
                            <p>Money, money, money, moooneeyyy $ $ $ $</p>
                        </div>
                    `
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值