Vue 3 composition API get value from object ref
问题 I have a ref : const editItem = ref<object | null>(null) Here's an example value for it: { id: 1, title: 'Harry Potter', author: 'J.K. Rowling', created: '30-08-2000', } If I run console.log(editItem.value) , I see this object: But when I try to read the value's author with console.log(editItem.value.author) , then I see this error: Object is possibly 'null'. 回答1: Since the type of the ref is object | null , it could be null when you access it, leading to a runtime exception. The error