Skip to content

Commit

Permalink
feat: add support for full Vue components of ipyvue (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariobuikhuizen authored Mar 30, 2020
1 parent 8715170 commit 2e93981
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
15 changes: 12 additions & 3 deletions js/src/VuetifyView.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DOMWidgetView } from '@jupyter-widgets/base';
import Vue from 'vue'; // eslint-disable-line import/no-extraneous-dependencies
import { vueRender } from 'jupyter-vue';
import { vueRender, createViewContext } from 'jupyter-vue';
import { getContainer } from './jupyterEnvironment';
import vuetify from './plugins/vuetify';

Expand Down Expand Up @@ -43,7 +43,9 @@ export class VuetifyView extends DOMWidgetView {
this.vueApp = new Vue({
vuetify,
el: vueEl,

provide: {
viewCtx: createViewContext(this),
},
render: (createElement) => {
// TODO: Don't use v-app in embedded mode
/* Prevent re-rendering of toplevel component. This happens on button-click in
Expand All @@ -60,6 +62,13 @@ export class VuetifyView extends DOMWidgetView {
}

vueRender(createElement) {
return vueRender(createElement, this.model, this);
return createElement({
provide: {
viewCtx: createViewContext(this),
},
render: () => {
return vueRender(createElement, this.model, this)
},
});
}
}
11 changes: 9 additions & 2 deletions js/src/nodepsVuetifyView.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { DOMWidgetView } from '@jupyter-widgets/base';
import { vueRender } from 'jupyter-vue';
import { vueRender, createViewContext } from 'jupyter-vue';

export class VuetifyView extends DOMWidgetView {
vueRender(createElement) {
return vueRender(createElement, this.model, this);
return createElement({
provide: {
viewCtx: createViewContext(this),
},
render: () => {
return vueRender(createElement, this.model, this)
},
});
}
}

0 comments on commit 2e93981

Please sign in to comment.