hello guys i found that i can return data but few things create confusion can anybody tell is this method is correct or not
method 1:
<script>
export default {
data () {
return {
nav: [],
}
},
mounted () {
this.checkSidebarVisibility()
},
methods: {
checkSidebarVisibility: function() {
this.nav= navnew
}
},
</script>
i know this method is 100% correct but when i use this method i faced problem like data is loading too late for eg :- if i use this method for select drop down then dat in select option after few second (atleast 3 sec)
method 2:
i have little confusion is this method is correct way in vue for eg:
<script>
export default {
data () {
return {
nav: this.checkSidebarVisibility(),
}
},
methods: {
checkSidebarVisibility: function() {
this.nav= navnew
}
},
</script>
i found this method load data quicky in select option as well as work fluent i.e without any error in browser console but i confused that is this correct way of vue can any expert can give any suggestion