Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

776
Vistas
Vue.js : Property or method is not defined on the instance but referenced during render

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.

enter image description here

Can someone please give me some hints ?

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

It seems a very simple mistake:

:title="Dashboard"

in Vue using a column (:) 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

over 4 years ago · Santiago Trujillo Denunciar

0

Using the binding sign : when using raw values in props means that values should be present as properties inside the script options :

 <MainPanel title="Dashboard" icon="dasboard" />
over 4 years ago · Santiago Trujillo Denunciar

0

According Vue2 official guide, props can simply get value from attribute or pass by v-bind to achieve responsive.

So in this case, you might want to using title instead :title.

<MainPanel title="Dashboard" icon="dasboard" />

If you want to make MainPanel title can be change responsively then you can clam a variable in data and pass by v-bind:

<MainPanel :title="varaibleForTitle" :icon="varaibleForIcon" />

By the way, you can pass a string value by v-bind - even though I don't understand why would anyone want to do this.

<MainPanel :title="'MainPanel'" :icon="'dasboard'" />

Cheers.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda