標籤:
一、引用
<link href="http://alonejs.suziyun.com:8080/alonejs.min.css" rel="stylesheet" /><script src="https://code.jquery.com/jquery-3.1.0.min.js"></script><script src="http://alonejs.suziyun.com:8080/alonejs.min.js"></script>
二、調用樣本
AloneJs.albumBox = function (fnOK) {
iBox.show({
title: "選擇圖片",
width: 705,
height: 425,
modal: true,
content: function (e) {
var $el = e.$scope; //擷取對話方塊的jQuery對象
AloneJs($el).showLoader(); //顯示載入進度條
$.ajax({
url: ‘/product/album.html‘,
type: ‘GET‘,
data: {
m: false
},
success: function (data) {
if (data) {
$el.html(data); //將非同步請求的html內容顯示在對話方塊中
e.window.adjustPosition(); //重新調整對話方塊的位置
}
AloneJs($el).closeLoader(); //關閉進度條
}
});
},
buttons: [
{
text: "取消"
},
{
text: "確定",
focus: true,
fn: function (e) {
var $win = e.$scope,
images = []; //定義數組記錄選中的圖片地址
//擷取選中的圖片
$win.find(‘.sl-album-photolist .photo-item-mask‘).each(function () {
var image = $(this).parent().attr("data-image");
if (image && image.length > 0) {
images.push(image);
}
});
if (images.length > 0) {
//執行回呼函數,並將選中的圖片數組作為參數傳入回呼函數
if ($.type(fnOK) == "function") {
fnOK(images);
}
} else {
iBox.msgbox("請選擇一張圖片!", { autoClose: 1200, modal: true });
return false;
}
}
}
]
});
};
其中,非同步請求“/product/album.html”頁面的內容即為內容:
AloneJs.albumBox() —— 相簿對話方塊