Elementui el-dialog 组件我又学会了一种新的用法

1.新建弹窗Form.vue文件 将visible属性设置为true

2.定义关闭弹窗方法closeDlg

closeDlg() {
        this.$router.back();
}

3.在父组件中定义弹窗按钮

 

4.定义弹窗方法add

 add() {
    this.$router.push({
       name: "pollutantsform"
    });     
 }

通过路由的方式将页面显示出来,弹窗默认是打开的 visible:true 打开页面从而也就打开了弹窗,关闭弹窗是通过this.$router.back的方式关闭的。

你可能感兴趣的:(Elementui el-dialog 组件我又学会了一种新的用法)