I am using Vue.js an I have a data object that I want to access properties dynamically. But I can't seem to be able to access the properties of the filters object dynamically.
export export default {
template: ``,
data() {
return {
something: 'This is some value.',
filters: {
fullSearch: 'This is full search.'
}
}
}
}
I can access "something" but I can't access filters.fullSearch dynamically.
This works
console.log(this['something']) // This is some value.
But this does not work
console.log(this['filters.fullSearch']) // Component.js:589 undefined
Here is the full code. I am looping through all of the properties of this.$route.query and assigning them to filters in my data like this. But it's not working. What am I doing wrong?
for (let [key, value] of Object.entries(this.$route.query)) {
if (this['filters.' + key] !== undefined) {
this['filters.' + key] = value
}
}