Last active
August 28, 2020 08:58
-
-
Save Jokcy/d4365548c2a7374f091a021124d655a3 to your computer and use it in GitHub Desktop.
vue3 ref problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const CompB = { | |
setup(props) { | |
const handleChange = (e) => { | |
props.value.name = e.target.value | |
props.onChange(props.value) | |
} | |
return () => { | |
const { value } = props | |
return <input onInput={handleChange} value={value} /> | |
} | |
} | |
} | |
const CompA = { | |
setup() { | |
const data = ref({}) | |
const handleChange = v => { | |
data.value = v | |
} | |
return () => <CompB value={data.value} onChange={handleChange} /> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment