this is my first function which i use to generate colors
<script>
shadeColor(color, percent) {
var R = parseInt(color.substring(1,3),16);
var G = parseInt(color.substring(3,5),16);
var B = parseInt(color.substring(5,7),16);
R = parseInt(R * (100 + percent) / 100);
G = parseInt(G * (100 + percent) / 100);
B = parseInt(B * (100 + percent) / 100);
R = (R<255)?R:255;
G = (G<255)?G:255;
B = (B<255)?B:255;
var RR = ((R.toString(16).length==1)?"0"+R.toString(16):R.toString(16));
var GG = ((G.toString(16).length==1)?"0"+G.toString(16):G.toString(16));
var BB = ((B.toString(16).length==1)?"0"+B.toString(16):B.toString(16));
return "#"+RR+GG+BB;
},
</script>
and my second function :
<script>
function flatten(data,color_var,order)
{
data.forEach(function (element)
{
order++;
element.category_order = order;
if(element.children.length > 0)
{
element.color = shadeColor(color_var,-4);
flatten(element.children,element.color,0);
}
element.color = shadeColor(color_var,-4);
});
return data;
}
</script>
which i want to put this two function inside my vue component and i don't know how to do it and this is my vue js code:
<v-card flat>
<draggable
class="draggable"
tag="div"
:="dragOptions"
@input="emitter"
:move="checkMove"
:list="list"
:value="value"
@update="saveUpdatedOrder"
>
<div class="item-group text-right" :key="el.id" v-for="el in realValue" :style="
{backgroundColor: el.color}" @click="loop">
<div class="item">{{ el.title }}</div>
<nested-test class="item-sub" :list="el.children" />
</div>
</draggable>
</v-card>
i am using vue draggable library i want to use them inside this list of elements and children Can anyone help me with this ??