UNPKG

nimble-ui

Version:
69 lines (65 loc) 1.85 kB
import { callFn } from 'nimble-lib'; import { PopupBase } from '../popup/PopupBase'; import Service from '../services'; export class Photo extends Service { name = 'Photo'; constructor (Vue, options) { super(options); let _that = this; _that.setDefaultOptions(options); _that._popup = new PopupBase(Vue, _that.defaultOption); _that._popup._getParent = () => { return _that._getParent && _that._getParent(); }; } /** * 模态框 * @param {Array} list 图片的列表 * @param {Objec} options 弹框文本内容 * @returns {*} */ photo (list, options) { let _that = this; let _options = _that.getOptions({ key: 'photo', wrapCla: 'nu_photo-popup', // 最外层追加的Class名 alignCla: 'fullScreen', // ''|'bottom'|'top'|'fullScreen'|'centerMiddle', transitionCls: 'toLeft', // ''|'bottom'|'top'|'fullScreen'|'centerMiddle', maskCloseFlag: 0, maskFlag: 1, isCloseBtn: true }, options, { props: { list: list } }); return _that._popup.popupData(() => { return callFn(_options.getComponent); }, _options); } /** * 安装 * * @param {Vue} Vue Vue * @param {Object} options 选项 * @memberof Service * @returns {Object} */ install(Vue, options) { let _that = this; super.install(Vue, options); _that._popup && _that._popup._setSPopup(Vue); return _that; } } /** * * 实例化工厂方法 * @export * @param {Vue} Vue vue * @param {any} options 配置选项 * @returns {Photo} */ export default function photoFactory(Vue, options) { return new Photo(Vue, options); }