nimble-ui
Version:
67 lines (64 loc) • 1.85 kB
JavaScript
import { callFn } from 'nimble-lib';
import { PopupBase } from '../popup/PopupBase';
import Service from '../services';
export class Operate extends Service {
name = 'Operate';
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();
};
}
/**
* operate弹框
* @param {Array<Array<String|Object>>} dataList 弹框选项
* @param {Object} options 弹框选项
* @returns {*}
*/
operate(dataList, options) {
let _that = this;
let _options = _that.getOptions({
key: 'operate',
wrapCla: 'nu_operate', // 最外层追加的Class名
alignCla: 'bottom', // ''|'bottom'|'top'|'fullScreen'|'centerMiddle',
transitionCls: 'toUp', // ''|toUp|scale|toBottom|toLeft;
maskCloseFlag: 0,
maskFlag: 1
}, options, {
props: {
list: dataList
}
});
return _that._popup.popupData(() => {
return callFn(_options.getComponent, ['operate']);
}, _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 {operateFactory}
*/
export default function operateFactory(Vue, options) {
return new Operate(Vue, options);
}