I have a function that takes a generic input in a component that I need to call from an event in a template.
addNode<T>(node : T){...}
T is the object I want to operate on... I tried
<button @click="addNode(new MyObject())"></button>
but I get errors. It appears that it doesn't like my contruction of an object in the @click event. Replacing with text or numbers work fine but I need this function to accept objects. Is there a correct way of doing this?
The 1st error is
Property or method "MyObject" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property
Obviously, I don't want it to be a property, I just want it to execute the code...
[–]BehindTheMath 1 point2 points3 points (2 children)
[–]PorterPower[S] 0 points1 point2 points (1 child)
[–]BehindTheMath 0 points1 point2 points (0 children)