实现数据分页显示有几种方法 web端分页内容切换时的数据是刷新还是?
大佬们,我一直有一个疑惑就是web端分页切换的时候每次都是刷新数据吗?还是说存到状态管理库里?我现在是使用的前者分页一般都是调用查询接口,获取新的数据,至于你说的存在状态管理库,目前没有遇到什么需要说
顺晟科技
2021-09-08 11:41:25
173
video标签播放视频 移动端不能自动播放 必须点击后才能播放
html5 video播放完切换画面方案
方法一
<pre>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="/js/jquery.min.1.8.3.js"></script>
</head>
<style>
html,body{
width:; height:;
}
</style>
<body>
//播放只能全屏
<video id="video1" style="width:; height:;object-fit: fill; display:none" src="http://mobile-show.cn/video/fromYou1.mp4" webkit-playsinline=""></video>
<script>
$(function () {
$(\'body\').bind(\'click\',function () {
$(\'#video1\').css(\'display\',\'block\');
$(\'#video1\')[0].play();
})
//播放完跳转页面 才能彻底的切换画面
$(\'#video1\').bind(\'error ended\', function(){
window.location.href=\'http://www.baidu.com\';
})
})
</script>
</body>
</html>
</pre>
方法二 最靠谱的方法(全屏播放)
<pre>
<video id="video1" style="overflow: hidden; width: ; width: ; display: none; " src="/solosea1/mp4/cai.mp4"
webkit-playsinline="true" class="video" height="" playsinline="true"
x5-video-player-type="h5" x5-video-player-fullscreen="true"></video>
</pre>
这个播放完不会弹出广告 播放完直接display:none 当然dom元素也能覆盖 就是不能加背景因为这个只能全屏播放 直接元素盖住他
切记不要加autoplay 加了下面事件会默认为播放处理的 其实他是不会自动播放的。。
demo如下
<pre>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="/js/jquery.min.1.8.3.js"></script>
</head>
<style>
html, body {
width: ;
height: ;
}
</style>
<body style="background: #FFF">
<video id="video1" style="overflow: hidden; width: ; width: ; display: none; " src="/solosea1/mp4/cai.mp4"
webkit-playsinline="true" class="video" height="" playsinline="true"
x5-video-player-type="h5" x5-video-player-fullscreen="true"></video>
<script>
$(function () {
getvideoprogress();
$(\'body\').bind(\'click\', function () {
$(\'#video1\').css(\'display\', \'block\');
$(\'#video1\')[0].play();
})
var vid = document.getElementById("video1");
vid.onended = function () {
$(\'#video1\').css(\'display\', \'none\');
alert("视频已播放完成");
};
})
function getvideoprogress() {
setTimeout(function () {
var vid = document.getElementById("video1");
var currentTime=vid.currentTime.toFixed(1);
if(currentTime>=1.2){
//触发
return false;
}
console.log(currentTime);
getvideoprogress();
}, 50);
}
</script>
</body>
</html>
</pre>
ps: onended="jieshuvideo()"也可以判断有没有结束
第三种 这种适用于不是全屏播放有进度条的
<pre>
<video src="{$yuming}/mp4/shipin.mp4" controls="" x5-playsinline="" playsinline="" webkit-playsinline="" poster="" preload="auto"></video>
</pre>
他这个可以直接display:none
第四种 更佳方法(可以全屏不全屏也没进度条 但是性能差的手机有卡顿 )
http://newmiracle.cn/?p=2384
ps:ios自动播放 直接加在wx.ready这个里面即可
01
2022-10
25
2022-09
16
2022-09
16
2022-09
16
2022-09
15
2022-09