Having trouble referencing an element in VueJS 3 CompositeAPI. In my current implementation, it looks like this:
<div ref="myIdentifier"></div>
setup() {
const myIdentifier = ref(null);
onMounted(() => {
console.log(myIdentifier.value); // When I try to access the value here, it returns a Proxy object instead of the Element object. Why is that happening?
console.log(myIdentifier.value.$el); // This line successfully returns the Element object
// The struggle continues:
// TypeScript keeps complaining with error TS2339 'Property ... does not exist on type 'never"
// even if I escape with myIdentifier.value?.$el or myIdentifier.value!.$el: TS2533 Object is possibly 'null' or 'undefined'
});
return {};
},
I feel like I might be missing something crucial here. My main aim is to easily have access to the HTML Element reference without having to deal with so much escaping and complexity.
Any help is greatly appreciated.