惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Hacker News
The Hacker News
F
Full Disclosure
Cloudbric
Cloudbric
Blog — PlanetScale
Blog — PlanetScale
W
WeLiveSecurity
N
News and Events Feed by Topic
T
Troy Hunt's Blog
V2EX - 技术
V2EX - 技术
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
B
Blog
GbyAI
GbyAI
C
Check Point Blog
B
Blog RSS Feed
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Recorded Future
Recorded Future
The Last Watchdog
The Last Watchdog
N
News and Events Feed by Topic
T
The Blog of Author Tim Ferriss
O
OpenAI News
V
V2EX
人人都是产品经理
人人都是产品经理
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
WordPress大学
WordPress大学
www.infosecurity-magazine.com
www.infosecurity-magazine.com
S
Security @ Cisco Blogs
C
Cisco Blogs
Security Latest
Security Latest
S
Security Affairs
V
Visual Studio Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园 - 司徒正美
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
Last Week in AI
Last Week in AI
AWS News Blog
AWS News Blog
雷峰网
雷峰网
Apple Machine Learning Research
Apple Machine Learning Research
PCI Perspectives
PCI Perspectives
博客园_首页
U
Unit 42
Google DeepMind News
Google DeepMind News
Hugging Face - Blog
Hugging Face - Blog
Project Zero
Project Zero
Cisco Talos Blog
Cisco Talos Blog
The Register - Security
The Register - Security
N
Netflix TechBlog - Medium
L
LINUX DO - 热门话题
H
Hacker News: Front Page

博客园 - 微宇宙

js-金额相加 小程序- 字符数据换行 antd-输入框去掉光晕 大屏缩放布局 大屏显示 echarts - 原型的方向盘动画 小程序- 自定义导航栏组件封装 小程序-echart动画git仓库 小程序- 隐私协议完善 小程序- 日期picker样式问题 echart - 折线图显示设置 echart - 移动端提示内容无阴影 echart 柱状图 - 零界点 正负方向展示 小程序 - 导航栏 图标设置 小程序 - 错误问题记录 react项目全屏功能 react-大屏显示antd浮窗 React andt库设置主题色彩 React闭包陷阱 git 操作 小程序 - 订阅消息通知 小程序-分包 mysql安装使用 redis安装使用 echart 格式化水平坐标 tooltip数据 小程序-模板用法 工作代码规范 小程序-锚链接 小程序-菜单tabbar设置 小程序-分享功能 小程序-树形结构 array数组 js 小程序-标题自定义设置 小程序-图表 小程序-拨打电话
小程序-登录验证码的加载方式
微宇宙 · 2026-01-14 · via 博客园 - 微宇宙

在登录 输入手机号,发送验证码,image 元素设置 src 链接传参带上时 time 间戳,保证每次点击验证码的框,都实时加载验证码。

// src = 'http://*******?time=123124334534' 
<view>
  <image style="width: 200px; height: 200px; background-color: #eeeeee;" mode="{{item.mode}}" src="{{src}}"></image>
</view>

如果遇到网络错误,加载不出来图片,可能是一个空白区域。

可以在图片加载的时候,做一个图片监听事件:

一个是 监听错误的事件 binderror;

一个是 监听加载的事件 bindload;

然后 给父级设置一个class类,在网络错误时,显示这个class类的伪类 :after{},反之成功加载不显示这个class类。

// src = 'http://*******?time=123124334534' 
<view class="isShow ? 'imgTxt' : '' ">
  <image style="width: 200px; height: 200px; background-color: #eeeeee;" mode="{{item.mode}}" src="{{src}}" bindload="bindload" binderror="binderror"></image>
</view>

bindload (){}
binderror (){}
'
.imgTxt image:after{
  content: '加载中'
  position: absolute;
  bacckground: #aaa;
}