I have
<template>
<div class="dashboard">
<Navbar />
<MainPanel :title="Dashboard" :icon="dasboard" />
</div>
</template>
<script>
import MainPanel from '../../components/MainPanel'
import Navbar from '../../components/Navbar'
export default {
name: 'Dashboard',
components: {
Navbar,
MainPanel
}
}
</script>
As you can see, I'm trying to reuse my MainPanel component.
MainPanel
<template>
<v-container fluid class="my-5">
<v-row>
<v-flex col-xs-12>
<v-card elevation="2" class="pb-15">
<v-flex xs12 class="text-center">
<v-card-title>
<v-btn dark text color="black">
<v-icon right class="mr-2">{{ icon }}</v-icon>
<span>{{ title }}</span>
</v-btn>
</v-card-title>
</v-flex>
</v-card>
</v-flex>
</v-row>
</v-container>
</template>
<script>
export default {
name: 'MainPanel',
props: {
icon: String,
title: String
},
data() {
return {
icon: '',
title: ''
}
}
}
</script>
<style lang=""></style>
In the console, I kept getting this error
[Vue warn]: Property or method "dasboard" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.
Can someone please give me some hints ?
It seems a very simple mistake:
:title="Dashboard"
in Vue using a colon (:
) to prepend a prop or an attribute on a component, will use a property defined or in props or in data.
While if you use title="dashboard"
you'll actually pass a string, that is what you want