可以通过HTML5+的gallery模块
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link href="../css/mui.min.css" rel="stylesheet" />
</head>
<body>
<header class="mui-bar mui-bar-nav">
<h1 class="mui-title">标题</h1>
</header>
<div class="mui-content">
<img src="" alt="" id="img_demo" />
<button type="button" class="mui-btn mui-btn-blue" id="show_gallery">打开相册</button>
</div>
<script src="../js/mui.min.js"></script>
<script type="text/javascript">
mui.init();
mui.plusReady(function() {
document.getElementById("show_gallery").addEventListener("tap", function() {
plus.gallery.pick(function(path) {
document.getElementById("img_demo").src = path;
}, function(e) {
console.log("取消选择图片");
}, {
filename: "_doc/gallery/",
filter: "image"
});
});
});
</script>
</body>
</html>
1 个回复
Trust - 少说废话
可以通过HTML5+的gallery模块