Answer the question
In order to leave comments, you need to log in
How to properly get data in Vue?
Good evening!
<template>
<div>
{{regions.region1}} //Получаем объект {region: 'name'}
{{regions.region}} //Пусто
</div>
</template>
<script>
export default {
name: "IndexCitySelect",
data(){
return {
region: 'region1',
regions: {
region1: {
region: "name",
},
},
}
}
}
</script>
Answer the question
In order to leave comments, you need to log in
You are accessing a property of an object that does not exist. The "regions" object has a property "region1" and this object also has a property: "region".
The "regions" object does not have a property: "region" that you are accessing, it only has "region1".
You must go through the chain: regions.region1.region;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question