Skip to content

Commit

Permalink
docs: fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mariobuikhuizen committed Nov 1, 2023
1 parent 9d8a21e commit 0ec320e
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 10 deletions.
8 changes: 8 additions & 0 deletions class_components.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
" input = Unicode().tag(sync=True)\n",
" something = Unicode('defaultvalue').tag(sync=True)\n",
" template = Unicode('''\n",
" <template>\n",
" <div style=\"border: 1px solid green; margin: 2px\" @click=\"append_one()\">\n",
" [{{ something }}] input: {{ input }} \n",
" </div>\n",
" </template> \n",
" ''').tag(sync=True)\n",
" \n",
" def vue_append_one(self, *args):\n",
Expand All @@ -44,6 +46,7 @@
" texts = List(['xxxx', 'yyyy']).tag(sync=True)\n",
" direct = Unicode('aaa').tag(sync=True)\n",
" template = Unicode('''\n",
" <template>\n",
" <div>\n",
" <div style=\"border: 1px solid black\">\n",
" <sub-component v-for=\"t in texts\" :input=\"t\" :key=\"t\" />\n",
Expand All @@ -52,6 +55,7 @@
" <w-button v-for=\"t in texts\" :description=\"t\" :key=\"t\" />\n",
" <w-button description=\"no v-for\"/>\n",
" </div>\n",
" </template>\n",
" ''').tag(sync=True)\n",
" \n",
" components=Dict({\n",
Expand Down Expand Up @@ -113,9 +117,11 @@
" label = Unicode().tag(sync=True)\n",
" \n",
" template = Unicode('''\n",
" <template>\n",
" <div style=\"border: 1px solid green; margin: 2px\">\n",
" [{{ label }}] Db URL: {{ info }}\n",
" </div>\n",
" </template>\n",
" ''').tag(sync=True)\n",
" \n",
" @observe('db')\n",
Expand All @@ -135,6 +141,7 @@
" supplier_db_collection = Dict().tag(sync_ref=True)\n",
" \n",
" template = Unicode('''\n",
" <template>\n",
" <div>\n",
" <database-info label=\"customers\" :db=\"customer_db\" />\n",
" \n",
Expand All @@ -146,6 +153,7 @@
" \n",
" <database-info label=\"function\" :db=\"{functionRef: 'db_factory', args: ['localhost/function1']}\" />\n",
" </div>\n",
" </template>\n",
" ''').tag(sync=True)\n",
" \n",
" components = Dict({\n",
Expand Down
2 changes: 2 additions & 0 deletions examples/DeepWatch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
" deep_array = traitlets.List(['array']).tag(sync=True)\n",
" deep_array2 = traitlets.List([{'prop': 'array2'}]).tag(sync=True)\n",
" template = traitlets.Unicode('''\n",
" <template>\n",
" <div>\n",
" <v-text-field v-model=\"deep.prop\" />\n",
" <v-text-field v-model=\"deep.deeper.prop\" />\n",
Expand All @@ -27,6 +28,7 @@
" {{ deep_array[0] }} |\n",
" {{ deep_array2[0].prop }}\n",
" </div>\n",
" </template>\n",
" ''').tag(sync=True)\n",
" \n",
"md = MyDeep()\n",
Expand Down
12 changes: 7 additions & 5 deletions examples/EmbeddingJupyterWidgetsInVueTemplate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@
"\n",
"\n",
" template=Unicode(\"\"\"\n",
" <div>\n",
" <div v-for=\"item in items\" :key=\"item.title + item.content\">\n",
" {{ item.title }}: <jupyter-widget :widget=\"item.content\" />\n",
" <template>\n",
" <div>\n",
" <div v-for=\"item in items\" :key=\"item.title + item.content\">\n",
" {{ item.title }}: <jupyter-widget :widget=\"item.content\" />\n",
" </div>\n",
" Single widget: <jupyter-widget :widget=\"single_widget\" />\n",
" </div>\n",
" Single widget: <jupyter-widget :widget=\"single_widget\" />\n",
" </div>\n",
" </template>\n",
" \"\"\").tag(sync=True)\n",
"\n",
"my_component = MyComponent()\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/fullVueComponent.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
"class Testing(v.VuetifyTemplate):\n",
" template = Unicode(\"\"\"\n",
" <template>\n",
" <test-comp :viewer=\"some_widget\"></test_comp>\n",
" <test-comp :viewer=\"some_widget\"></test-comp>\n",
" </template>\n",
" \"\"\").tag(sync=True)\n",
" \n",
Expand Down
2 changes: 1 addition & 1 deletion examples/hot-reload/my_component.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</div>
</template>
<script>
module.exports = {
export default {
props: ['my-data']
}
</script>
2 changes: 1 addition & 1 deletion examples/hot-reload/my_sub_component.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
</template>
<script>
module.exports = {
export default {
props: ['label']
}
</script>
2 changes: 1 addition & 1 deletion examples/hot-reload/my_widget_template.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<h1>My Widget template</h1>
<my-component :my-data="some_data"></my-component>
<my-component :my-data="some_data"/>
</div>
</template>
2 changes: 1 addition & 1 deletion js/src/VueTemplateRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ function createClassComponents(components, containerModel, parentView) {
{
create_widget: componentSpec.class, // eslint-disable-line camelcase
id: this.id,
props: this.$options.propsData,
props: this.$props,
},
containerModel.callbacks(parentView),
);
Expand Down

0 comments on commit 0ec320e

Please sign in to comment.