Skip to content

Instantly share code, notes, and snippets.

@Jokcy
Last active August 28, 2020 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jokcy/d4365548c2a7374f091a021124d655a3 to your computer and use it in GitHub Desktop.
Save Jokcy/d4365548c2a7374f091a021124d655a3 to your computer and use it in GitHub Desktop.
vue3 ref problem
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