微信 WeixinJSBridge 使用案例 调用内置图片浏览功能
微信 WeixinJSBridge 使用案例 调用内置图片浏览功能
下面的页面需要在微信中打开
index.html:
<!DOCTYPE html> <html> <meta charset="utf-8" /> <button id="imagePreview" style="text-align:center;">点击调用微信内置预览图片</button> <script> document.getElementById('imagePreview').addEventListener('click', function(){ WeixinJSBridge.invoke('imagePreview', { current: 'http://inews.gtimg.com/newsapp_bt/0/1693121381/641', urls: [ // 所有图片的URL列表,数组格式 'https://img1.gtimg.com/10/1048/104857/10485731_980x1200_0.jpg', 'https://img1.gtimg.com/10/1048/104857/10485726_980x1200_0.jpg', 'https://img1.gtimg.com/10/1048/104857/10485729_980x1200_0.jpg' ] }, function(res) { console.log(res.err_msg) }) }); </script> </html>
微信的js-sdk里面有大量的功能供你这样调用