uni.app.启动闪屏首页后到登录页

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
使用`window.location.href`可以实现面跳转。当你将一个新的URL赋值给`window.location.href`时,浏览器会加载该URL对应的面,并在当前窗口中显示。 要实现闪屏效果,你可以在跳转之前先显示一个闪屏面,然后再跳转到目标面。以下是一个简单的示例代码: ```javascript // 显示闪屏面 function showSplashScreen() { // 在面中创建一个元素,用于显示闪屏内容 var splashScreen = document.createElement('div'); splashScreen.style.width = '100%'; splashScreen.style.height = '100%'; splashScreen.style.backgroundColor = 'white'; splashScreen.style.display = 'flex'; splashScreen.style.justifyContent = 'center'; splashScreen.style.alignItems = 'center'; // 在闪屏面中添加一些内容,比如加载动画或者公司logo等 splashScreen.innerHTML = '<h1>Loading...</h1>'; // 将闪屏面添加到body元素中 document.body.appendChild(splashScreen); } // 跳转到目标面 function redirectToTargetPage() { // 显示闪屏面 showSplashScreen(); // 延时一段时间后跳转到目标面 setTimeout(function() { window.location.href = '目标面的URL'; }, 2000); // 延时2秒钟,可以根据需要调整时间 } // 调用函数实现跳转闪屏效果 redirectToTargetPage(); ``` 在上面的代码中,`showSplashScreen`函数用于显示闪屏面,你可以根据需要自定义闪屏面的样式和内容。`redirectToTargetPage`函数用于跳转到目标面,其中通过`setTimeout`函数设置了一个延时,延时结束后会将`window.location.href`设置为目标面的URL,实现面跳转。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值