0👍
data()
method is not designed to create complex objects with methods. You can just create an empty variable in data()
method, then fill it with your object in created
hook or mounted
hook. You’ll be able to access the component via this
variable if use arrow-function for init
method inside your object.
Source:stackexchange.com