Skip to content

Commit

Permalink
fix(vue3): Add workaround for Vue extends bug
Browse files Browse the repository at this point in the history
  • Loading branch information
emccorson committed Jul 25, 2022
1 parent d8919c9 commit ead935e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion vue3-onsenui-examples/src/components/Navigator.vue
Expand Up @@ -104,7 +104,7 @@
log,
push() {
this.$emit('push', markRaw({
...page2,
extends: page2,
onsNavigatorProps: {
myProp: 'This is a navigator prop'
}
Expand Down
14 changes: 13 additions & 1 deletion vue3-onsenui/src/components/VOnsNavigator.vue
Expand Up @@ -2,7 +2,7 @@
<ons-navigator @postpop.self="_checkUserInteraction" :options.prop="options">
<slot>
<component
v-for="(page, index) in internalPageStack"
v-for="(page, index) in extendsFix"
:is="page"
:key="index"
v-bind="{ ...unrecognizedListeners, ...page.onsNavigatorProps }"
Expand Down Expand Up @@ -36,6 +36,18 @@
};
},
computed: {
extendsFix() {
// workaround for Vue bug where extends doesn't work with runtime template compilation
// https://github.com/vuejs/core/issues/6249
return this.internalPageStack.map(page =>
page.extends ?
{...page, template: page.extends.template} :
page
);
}
},
methods: {
isReady() {
if (this.hasOwnProperty('_ready') && this._ready instanceof Promise) {
Expand Down

0 comments on commit ead935e

Please sign in to comment.