在Django中显示加载微调器的最佳方法? [英] Best way to display a loading spinner in Django?

查看:93
本文介绍了在Django中显示加载微调器的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在相对冗长的服务器端处理任务期间,在Django中显示加载微调器的最佳方法是什么?这是JS/jQuery应该处理的吗?

What is the best way to display a loading spinner in Django during a relatively lengthy server-side processing task? Is this something that JS/jQuery should handle?

如果是这样,我如何获得按钮单击以启动服务器端处理以启动微调器?

If so, how do I get the button click that starts the server-side processing to initiate the spinner?

此处是Django新手,因此感谢您的投入.谢谢!

Django novice here, so I appreciate any input. Thanks!

推荐答案

执行此操作的方法有很多,我将建议最简单的方法:

There are many ways of doing this, I'm going to suggest the simplest:

是的.我知道,您可能在想,动画gif太俗气了!"

yes. I know, you're probably thinking, "animated gifs are tacky!"

我回答:只有它们很丑."

to which I reply: "only if they're ugly."

将一个简单的加载微调器动画制作为gif,并在需要显示时将其添加到显示列表中.该过程结束后,将其从显示列表中删除.

Make a simple loading spinner animation as a gif, and add it to the display list when you want it shown. When the process is over, remove it from the display list.

这是我想出的动画gif的唯一用途.

It's about the only good use of an animated gif I've ever come up with.

这篇关于在Django中显示加载微调器的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆