代码编织梦想

1、看图片:

调用 uni.previewImage 

uni.previewImage({
	urls: arr, //需要预览的图片http链接列表,多张的时候,url直接写在后面就行了
	current:0, // 当前显示图片的http链接,默认是第一个
	success: function(res) {},
	fail: function(res) {},
	complete: function(res) {},
})

2、看视频(我记得不能直接调用 必须搭配vedio使用):

<u-modal :show="show" cancelText="关闭" :showConfirmButton="false" :showCancelButton="true" @cancel="cancel">
	<video id="myVideo" class="myVideo" :src="previewVideoSrc">
	</video>
</u-modal>

3、看pdf:

调用 uni.downloadFile 和 uni.openDocument

uni.downloadFile({
	url: url,
	success: function (res) {
		var filePath = res.tempFilePath;
			uni.openDocument({
				filePath: filePath,
				showMenu: true,
				success: function (res) {
					 console.log('打开文档成功');
				}
			});
			}
});

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/m0_58060036/article/details/130881403