tdesign-vue
Version:
81 lines (73 loc) • 2.54 kB
JavaScript
/**
* tdesign v1.15.0
* (c) 2026 tdesign
* @license MIT
*/
;
Object.defineProperty(exports, '__esModule', { value: true });
var Vue = require('vue');
var imageViewer_props = require('../props.js');
var utils_dom = require('../../utils/dom.js');
require('raf');
require('../../utils/easing.js');
require('../../_chunks/dep-a2217d56.js');
require('../../_chunks/dep-3b2292ce.js');
require('@babel/runtime/helpers/typeof');
require('../../_chunks/dep-10fcb46d.js');
require('../../_chunks/dep-ba7f5924.js');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Vue__default = /*#__PURE__*/_interopDefaultLegacy(Vue);
var Container = Vue__default["default"].extend({
props: {
mode: imageViewer_props["default"].mode,
renderModal: Function,
renderViewer: Function
},
data: function data() {
return {
content: null,
timer: null
};
},
methods: {
mountContent: function mountContent() {
clearTimeout(this.timer);
if (this.content) return;
var _this = this;
var elm = document.createElement("div");
elm.style.cssText = "position: absolute; top: 0px; left: 0px; width: 100%";
this.content = new this.$root.constructor({
render: function render() {
return _this.mode === "modeless" ? _this.renderModal() : _this.renderViewer();
},
destroyed: function destroyed() {
if (_this.content.$el) {
utils_dom.removeDom(_this.content.$el);
}
_this.content = null;
}
});
utils_dom.getAttach(document.body).appendChild(elm);
this.content.$mount(elm);
},
unmountContent: function unmountContent() {
var _this2 = this;
clearTimeout(this.timer);
this.timer = setTimeout(function () {
var _this2$content, _this2$content$$destr;
(_this2$content = _this2.content) === null || _this2$content === void 0 || (_this2$content$$destr = _this2$content.$destroy) === null || _this2$content$$destr === void 0 || _this2$content$$destr.call(_this2$content);
}, 200);
}
},
render: function render() {
var _children$;
var h = arguments[0];
var children = this.$slots["default"] || [];
if (children.length > 1 || !((_children$ = children[0]) !== null && _children$ !== void 0 && _children$.tag)) {
return h("span", [children]);
}
return children[0];
}
});
exports["default"] = Container;
//# sourceMappingURL=Container.js.map