[英]How to know the browser page whether is loading in Vue.js project?
How to know the browser page whether is loading in Vue.js project? 如何知道浏览器页面是否正在Vue.js项目中加载?
in browser, such as in Chrome, if we open a page, if the networking is not finish, there will have a circle animation. 在浏览器中(例如在Chrome中),如果我们打开一个页面,如果联网尚未完成,则会出现一个圆形动画。
but in our development, how can we get this status? 但是在我们的发展中,我们如何获得这种地位?
You can do this using simple Javascript 您可以使用简单的Javascript执行此操作
if (document.readyState == "completed") {
alert("Your page is loaded");
}
Return Value : A String, representing the status of the current document. 返回值 :一个字符串,表示当前文档的状态。
One of five values: 五个值之一:
For more details visit W3Schools - document.readystate . 有关更多详细信息,请访问W3Schools-document.readystate 。
Hope this solves your query. 希望这可以解决您的查询。
I think what you are searching for is the javascript/HTML onLoad()
event. 我认为您要搜索的是javascript / HTML
onLoad()
事件。 It's called when a page has been loaded, as an HTML tag you can add a function call which will be executed once the page is loaded and same goes for Javascript where you can create an eventListener to call a function following the same event. 当页面被加载时调用它,作为HTML标签,您可以添加一个函数调用,该函数调用将在页面加载后执行,Java脚本也是如此,您可以在其中创建eventListener来在同一事件之后调用函数。
Here is an helpfull link: OnLoad W3School 这是一个有用的链接: OnLoad W3School
Window.onload() method detect when a page is loaded. Window.onload()方法检测何时加载页面。 may this can be helpful
这可能会有所帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.