简体   繁体   English

Vue.js-加载服务-元素用户界面

[英]Vue.js - Loading service - Element UI

I would like to use the loading service of Element UI framework. 我想使用Element UI框架的加载服务。 I read the documentation but I have hard time to figure out how to use it. 我阅读了文档,但很难弄清楚如何使用它。

Let's take an example: how to display the loading only in the dialog when pressing on the confirm button of this dialog 让我们举个例子:在按压时如何只在对话框中显示加载confirm这个按钮dialog

https://jsfiddle.net/5xmoxwsy/1/ https://jsfiddle.net/5xmoxwsy/1/

Thank you 谢谢

Add ref to dialog: 向对话框添加引用:

 ref="dialog"

Bind click to method in vm: 将点击绑定到vm中的方法:

 @click="Confirm"

Methods: 方法:

methods: {
    Confirm() {
        var self = this;
        var loadingInstance = window.ELEMENT.Loading.service(
        {
            target: self.$refs.dialog.$el.querySelector('.el-dialog')
        });
        setTimeout(function(){
            self.dialogFormVisible = false;
            loadingInstance.close();
        },1000);
    }
}

jsfiddle 的jsfiddle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM