Vue常用弹出框类组件(持续更新)

🐰

书签

vue-js-modal

npm:https://www.npmjs.com/package/vue-js-modal

Demo: http://vue-js-modal.yev.io/

basic

img

安装

1
npm install vue-js-modal --save

引入

main.js 文件

1
2
3
import VModal from 'vue-js-modal'

Vue.use(VModal)
自定义组件名
1
2
// 默认组件名为 "modal",如果需要自定义则:
Vue.use(VModal, { componentName: "foo-modal" })

组件中使用:

1
<foo-modal name="bar"></foo-modal>

在组件中使用

Create modal:

1
2
3
<modal name="hello-world">
hello, world!
</modal>

Call it from anywhere in the app:

1
2
3
4
5
6
7
8
methods: {
show () {
this.$modal.show('hello-world');
},
hide () {
this.$modal.hide('hello-world');
}
}

You can easily send data into the modal:

1
this.$modal.show('hello-world', { foo: 'bar' })

And receive it in beforeOpen event handler:

1
2
3
4
5
6
<modal name="hello-world" @before-open="beforeOpen"/>
methods: {
beforeOpen (event) {
console.log(event.params.foo);
}
}

Dialog

img

查看demo演示:http://vue-js-modal.yev.io/

npm:https://www.npmjs.com/package/vue-js-modal#dialog

1
2


------------- 本文到此结束啦 感谢您的阅读 ♪(^∀^●)ノ -------------
0%