javascript - 为什么标记 loadstart 事件不触发?有替代方案吗?
问题描述
我将 vuejs 与 Element UI 一起使用,我想在开始从 src attr 加载图像时显示加载指示器,在load
事件(加载的 img)触发时隐藏加载指示器。
该load
事件运行良好,但从loadstart
不触发。
这是片段:
<div v-loading="imgLoading">
<img
:src="imgOfSelectedColor"
@loadstart="showImgLoading"
@load="hideImgLoading"
@error="hideImgLoading"
@abort="hideImgLoading"
>
</div>
export default {
data() {
return {
imgLoading: false
};
},
methods: {
showImgLoading() {
this.imgLoading = true;
},
hideImgLoading() {
this.imgLoading = false;
}
}
}
解决方案
推荐阅读
- c# - 无论用户如何移动文件(C#)
- java - WebTestclient 正在抛出 Null Exception,@Autowire 在那里
- r - Predict () 基于给定的 x - 许多人遇到这个问题,但没有一个答案有效
- python - 在 Plotly Python 中按组创建重叠边界
- excel - 动态数组函数可以用作 Excel 中列表验证(“下拉”)的源吗?
- php - 如何在获取数据时调试 codeigniter 错误
- python - 如何抑制子进程输出
- c++ - 如果它是 r 值引用,是否可以返回当前对象?
- tinyproxy - 是否可以同时将 tinyproxy 设置为正向代理和反向代理?
- f# - 在 f# 中使用 Result 提取结果或聚合错误的简洁方法