diff --git a/src/utils/registerCustomElement.js b/src/utils/registerCustomElement.js index b864f04..109a20b 100644 --- a/src/utils/registerCustomElement.js +++ b/src/utils/registerCustomElement.js @@ -7,6 +7,8 @@ export default function registerCustomElement(tag, options = {}) { function constructorCallback() { if (options.shadow === true && HTMLElement.prototype.attachShadow) { this.attachShadow({ mode: 'open' }); + } else if (typeof options.shadow === 'object' && HTMLElement.prototype.attachShadow) { + this.attachShadow(options.shadow); } typeof options.constructorCallback === 'function' && options.constructorCallback.call(this); } diff --git a/src/vue-custom-element.js b/src/vue-custom-element.js index edec486..6421d14 100644 --- a/src/vue-custom-element.js +++ b/src/vue-custom-element.js @@ -74,7 +74,7 @@ function install(Vue) { observedAttributes: props.hyphenate, - shadow: !!options.shadow && !!HTMLElement.prototype.attachShadow + shadow: typeof options.shadow === 'object' ? options.shadow : !!options.shadow && !!HTMLElement.prototype.attachShadow, }); return CustomElement;