<view class="video">
<video id="myVideo" class="video-back" src="/videos/Mengniu_milk_demo.mp4" danmu-list="{{danmuList}}" enable-danmu danmu-btn controls></video>
</view>
.video {
display: flex;
justify-content: center;
align-items: center;
margin-left:25px;
margin-right:25px;//这里我调了左右边距
}
.video-back{
height:180px //官方文档给的默认宽度 300px、高度 225px,可通过 wxss 设置宽高。
}
danmu-list="{{danmuList}}" enable-danmu danmu-btn controls
官方文档这里给出了danmu开关的使用方法,这里我们不需要将它移除就可以了。
同时也可以根据自己的需求在里面添加poster="/img/btnScan.png"等配置
根据项目结构设计,新建videos(公共视频文件夹,将视频放在里面)
后面发现小程序对包的大小有限制,所以视频资源采用外链比较好。
小程序label加下划线,在wxss里面加上:
.humanService{
color:orange;
font-size: 25rpx;
display: flex;
justify-content: center;
align-items: center;//这是居中
margin-top:25rpx;
text-decoration-line: underline;
}
去除小程序按钮默认样式:
button::after {
border: none;
}
button {
background-color: #fff;
}