0

I've a list of Vue objects like this:

vue_objectname0,

vue_objectname1,

vue_objectname2 etc...

these object rae created by:

var vue_objectname0 = new Vue({
  el: '#vue_objectname0',
  data: {
    seen: true,
  }
})

from browser console I can correctly access data with:

vue_objectname0.seen

now I need to access the same data from a string as name of the object, how can I convert the string to the Object?

var name = "vue_objectname"+number;
console.log(name.seen);

this return "undefined"

1 Answer 1

1

All global variable can be accessed using the window object as well.

window["vue_objectname"+number]

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.