2π
β
As discussed in the comments to your post, itβs due to the async API call yo do in created()
to get the permissions object initially.
I suggest you use something like https://github.com/vuejs/vue-async-data. It allows you to get data asynchronously (e.g. with vue-resource) and gives you a way to hide components content until loading the data has finished.
Though you can easily simulate this on your own:
data: function () {
return { loaded: false, permissions: {} }
},
created() {
return this.$http(...).then(function (result) {
this.permissions = result.data.permissions // or however your data is
this.loaded = true
})
}
and in the template, use v-if="loaded"
on a wrapping div to hide the content until permissions are actually loaded.
π€Linus Borg
0π
It is because permissions
is not Vue path
object. Once you pass it as prop it will become one, and you will be able to reference it like that. Could you provide full code for your component for further explanation?
π€bartlomieju
Source:stackexchange.com