Hi @Anna.fae,
can you send me the data you are binding? Are they the same?
One difference on your usecase may be that the array is empty, then populated when you bind the formula (or when your collection is fetch if your formula depends on a collection).
Is your component reacting to a change of the inputArray value ?
Hi @Anna.fae,
as i guessed, your code does not react to variable change
Move the images data to a computed, so that your data is always up to date
Add a watch to your images after mount, so that your canvas is always synchronise with your data
<template>
<div class="my-element">
<p :style="textStyle">I am a custom element !</p>
<canvas ref="canvas" width="800" height="800" style="border:1px solid #d3d3d3;">
</canvas>
</div>
</template>
<script>
import { computed, ref } from 'vue';
export default {
computed: {
images() { return this.content.inputArray } // here you can also check that the data are valid or you can do it on the drawImages method
},
watch: {
images() {
this.drawImages(this.images);
}
}
},
Hope this help, let me know if you need more explanations
Hello Anna, I need a little help in developing a custom weweb component.
I am new to weweb and i have very little deadline to complete this task. I just want to know the process little bit for adding my component as expected.
Bascially i have to create a custom accordion type component. In which user can add multiple cards and some configurations. In each card user will be able to set:
Title
Text
Link (link text, url, visibility)
Image
It will contain 2 columns one column will have image and the second column will have the accordion items and whatever item user will open in accordion the relevant image will be displayed in the first column. If you visit aritable.com then you can check it out and i am building exactly same. I shared the screenshot
for that section with you. If we think about the flow there should be a button in the side panel on weweb that will allow user to add multiple items and for each item user can set the data whatever i shared above. Moreoever, there will be some more properties like font size, color etc and it will effect the whole component.
So, my question is while creating a weweb component there are 2 options:
Section
Element
Which option suits best in my case and how to set the properties for each item of accordion. We have to set dynamic properties in an array. I can set all other general properties but not sure how dynamic array will work. If you can share your knowledge with me then it will be much appreciated. Thanks