0

All the children always equal 100%. This means when I increase one child, all the other children are reduced.

I want to change the slider value manually and by programming

I am using typescript in a composition <script setup lang="ts">

In the TreeItem I have a slider that changes. I can emit this change to the TreeRow.

I pass the data and the parent data down the tree using props.

const props = defineProps<{
    "parent": wasm.JAcct,
    'acct': wasm.JAcct,
    "level": number
}>()

where JAcct is defined as in RUST as:

#[wasm_bindgen(getter_with_clone)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct JAcct {
    pub id: String,
    pub name: String,
    pub key: BKey,
    pub value: f64,
    pub original: i64,
    pub percent: f64,
    pub locked: bool,
    pub children: Vec<JAcct>,
}

This is how I create the tree

<div  v-show="show" v-for="chld in acct.children" :key="chld.id">
    <TreeRow :acct="chld" :parent="acct" :level="level+1" />
</div>

But this does not pass the parent component, just the parent data. Using options API I would use :parent="this" or this.$parent How do I access the parent component in composition API?

That would allow me to change the slider value using typescript or manual.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.