diff --git a/src/layer/index.js b/src/layer/index.js index 3dfb38c..2bf54ba 100644 --- a/src/layer/index.js +++ b/src/layer/index.js @@ -4,17 +4,8 @@ * @date 2023/03/06 15:17:25 */ -import { - css, - html, - Component, - bind, - unbind, - nextTick, - styleMap -} from '@bd/core' +import { css, html, Component, bind, styleMap } from '@bd/core' import '../form/input.js' -import Drag from '../drag/core.js' let uniqueInstance = null // 缓存当前打开的alert/confirm/prompt类型的弹窗 let toastInstance = null // 缓存toast的实例 @@ -40,7 +31,8 @@ class Layer extends Component { right: { type: String, attribute: false }, top: { type: String, attribute: false }, bottom: { type: String, attribute: false }, - fixed: false, + background: { type: String, attribute: false }, + 'mask-color': { type: String, attribute: false }, mask: false, 'mask-close': false, title: { type: String, default: '', attribute: false }, @@ -280,7 +272,6 @@ class Layer extends Component { ] #wrapped = false - #dragIns = null #resolve = null #reject = null @@ -296,27 +287,6 @@ class Layer extends Component { this.promise.host = this } - #toggleDrag() { - // 这3类弹层不允许拖拽 - if (UNIQUE_TYPES.includes(this.type)) { - return - } - - if (this.fixed) { - // 如之前有拖拽实例, 先销毁 - if (this.#dragIns) { - this.#dragIns.destroy() - this.#dragIns = null - } - return - } - let $title = this.$refs.box.firstElementChild - - this.#dragIns = new Drag(this.$refs.box).by($title, { - overflow: !!this.overflow - }) - } - #intercept(value) { if (this.intercept) { this.intercept(value, _ => { @@ -400,7 +370,9 @@ class Layer extends Component { } } - this.#toggleDrag() + if (this.background) { + this.$refs.box.style.backgroundColor = this.background + } this.#play() } @@ -432,10 +404,6 @@ class Layer extends Component { this.type = null this.$emit('close') } else { - // 有拖拽实例, 先销毁 - if (this.#dragIns) { - this.#dragIns.destroy() - } // 不允许多开的类型, 需要清除 if (UNIQUE_TYPES.includes(this.type)) { uniqueInstance = null