src 的资源加载完毕
的时候,才会触发<img src="showImg.png" @load="isLoad">
methods:{
isLoad(){
console.log('资料加载完毕')
}
}
template
<div class="loading-image">
<img @load="successLoadImg" v-bind:src="spot.Picture.PictureUrl1" alt="载入图片">
</div>
style
.loading-image{
height: 100%;
position: relative;
background-color: #FFF;
background-image: url(../src/assets/loading.png);
background-repeat: no-repeat;
background-size: 100%;
&.hide{
display: none;
}
}
js
利用 prototype 设定全局函式,可以重复使用。
Vue.prototype.successLoadImg = function (event){
event.target.parentElement.classList.add('hide');
document.querySelectorAll(".loading-image.hide").forEach(e => e.remove())
};
参考来源:
https://blog.csdn.net/muzidigbig/article/details/115167044
https://www.itread01.com/article/1489633818.html
>>: Microsoft Azure Machine Learning - Day 2
环境 Windows 10 21H1 x64dbg Aug 2 2020, 13:56:14 IDA...
前言 终於来到铁人赛的第29天啦,今天的内容是把之前做好的Line股价机器人 部署到Heroku 上...
在 Nuxt.js 中,我们建立路由不必再自己撰写虚拟路由了,直接建立在 page 内即可 若是要使...
昨天看到FetchData.razor的程序太长了,截图都要两次,为求方便,我们把@code的部分撷...
让注册会员收到email认证信 方法是在settings内定义好email port等等资讯 注意此...