Skip to content

Commit

Permalink
update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
Kurtil committed Jun 18, 2020
1 parent ad12240 commit d8135ed
Showing 1 changed file with 48 additions and 10 deletions.
58 changes: 48 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,22 @@
data() {
return {
areasSize: null,
}
};
},
mounted() {
this.$watch(() => this.$refs.areas.size, size => {
this.areasSize = size;
}, {
immediate: true
});
this.$watch(
() => this.$refs.areas.size,
(size) => {
this.areasSize = size;
},
{
immediate: true,
}
);
},
render(h) {
return h("div", { style: "width: 80%; margin: auto; height: 80%;" }, [
h(headerComponent, {props: {areasSize: this.areasSize}}),
h(headerComponent, { props: { areasSize: this.areasSize } }),
h(Areas, {
ref: "areas",
props: {
Expand All @@ -135,13 +139,34 @@
},
components: [
{
props: {
text: {
type: String,
default: "No text provided"
}
},
render(h) {
return h("div", "Content I");
return h("div", `Content I. Text: ${this.text}`);
},
},
{
inject: ["$area"],
props: {
list: {
type: Array,
default: () => [],
},
},
methods: {
onClick() {
console.log("Clicked :D !");
}
},
render(h) {
return h("div", "Content II");
return h("div", [
h("button", {on: {click:this.onClick}}, "Click Me :D"),
h("ul", this.list.map(li => h("li", li)))
]);
},
},
{
Expand Down Expand Up @@ -225,14 +250,25 @@
ratios: [20, 80],
children: [
{
name: "test",
componentIndex: 0,
cfg: {
props: {
text: null
}
}
},
{
direction: "column",
ratios: [40, 60],
children: [
{
componentIndex: 1,
cfg: {
props: {
list: ["jean", "yo", "marcel"]
}
}
},
{
componentIndex: 2,
Expand Down Expand Up @@ -268,7 +304,9 @@
}).$mount("#app");

areas = vm.$refs.areas;
// areas.getAreaContentByName("comp1").cfg.props.text = "Youhou ! =D"; // This is reactive !
areas.getAreaContentByName("test").cfg.props.text = "32"; // This is reactive !

window.areas = areas;
</script>
</body>
</html>

0 comments on commit d8135ed

Please sign in to comment.