diff --git a/dist/vue-wc-wrapper.global.js b/dist/vue-wc-wrapper.global.js index 889a242..1cb08a2 100644 --- a/dist/vue-wc-wrapper.global.js +++ b/dist/vue-wc-wrapper.global.js @@ -140,6 +140,15 @@ function wrap (Vue, Component) { }); }); + // proxy methods as Element methods + Object.keys(options.methods || {}).forEach(key => { + Object.defineProperty(CustomElement.prototype, key, { + value (...args) { + return options.methods[key].call(this.vueComponent, ...args) + } + }); + }); + // proxy props as Element properties camelizedPropsList.forEach(key => { Object.defineProperty(CustomElement.prototype, key, { diff --git a/dist/vue-wc-wrapper.js b/dist/vue-wc-wrapper.js index 721bf1f..f2dc229 100644 --- a/dist/vue-wc-wrapper.js +++ b/dist/vue-wc-wrapper.js @@ -137,6 +137,15 @@ function wrap (Vue, Component) { }); }); + // proxy methods as Element methods + Object.keys(options.methods || {}).forEach(key => { + Object.defineProperty(CustomElement.prototype, key, { + value (...args) { + return options.methods[key].call(this.vueComponent, ...args) + } + }); + }); + // proxy props as Element properties camelizedPropsList.forEach(key => { Object.defineProperty(CustomElement.prototype, key, { diff --git a/src/index.js b/src/index.js index 4409bd7..80453c3 100644 --- a/src/index.js +++ b/src/index.js @@ -51,6 +51,15 @@ export default function wrap (Vue, Component) { }) }) + // proxy methods as Element methods + Object.keys(options.methods || {}).forEach(key => { + Object.defineProperty(CustomElement.prototype, key, { + value (...args) { + return options.methods[key].call(this.vueComponent, ...args) + } + }) + }) + // proxy props as Element properties camelizedPropsList.forEach(key => { Object.defineProperty(CustomElement.prototype, key, {