Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

286
Views
ref is not woking(reactive) when use jsx in vue3

First let me explain what happend, I pretend to make a like cascader code system, when click first-level option, it will be display(shown) sencond-level option, and so on.

But quickly i meet some problem, I use v-modal bind child.value, It's not working, I dont't kown why ?

import { defineComponent, ref, watch } from "vue";
export default defineComponent({
  props: {
   data: {
     type: Array
   }
  },
  setup() {
   const linkedList = ref([{
      value: undefined,
      options: props.data,
    }]);
function handleChange(value, option) {

      const currentData = linkedList.value[linkedList.value.length - 1]
      const { level: crrentLevel } = currentData

      const nextData = option.find(item => item.option_index == value)
      const { level: nextLevel, option_index, children } = nextData
      // add next level data
      if(nextLevel > crrentLevel) {
        linkedList.value.push({
          value: undefined,
          options: children
        })
      }
    }
    return () => (
      <div>
        {linkedList.value.map((child) => (
        <a-select v-model={child.value} onChange={e => handleChange(e, child.options)}  style={{minWidth: '100px'}}>
          {child.options.map((option) => (
            <a-select-option
              key={option.option_key}
              value={option.option_index}
            >{option.option}</a-select-option>
          ))}
        </a-select>
      ))}
      </div>
    );
  }
})
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!