Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

118
Visualizações
[Vue warn]: Property or method "maximum" is not defined on the instance but referenced during render

My component:

Vue.component("product-list", {
  props: ["products", "maximum-price"],
  template: `
    <div>
      <div class="row d-flex mb-3 align-items-center p-3 rounded-3 animate__animated animate__fadeInLeft" v-for="(item, index) in products" :key="index" v-if="item.price <= Number(maximum-price)" style="background-color: #e3e3e3">
        <!-- Col-1 -->
        <div class="col-1">
          <button class="btn btn-warning" @click="addItem(item)">Beli</button>
        </div>

        <!-- Col-2 -->
        <div class="col-sm-4">
          <img :src="item.image" :alt="item.name" class="img-fluid d-block" />
        </div>

        <!-- Col-3 -->
        <div class="col">
          <h3 class="text-info">{{ item.name }}</h3>
          <p class="mb-0">{{ item.description }}</p>
          <div class="h5 float-end">
            <price-card :prefix="'$'" :value="item.price" :precision="3"></price-card>
          </div>
        </div>
      </div>
    </div>
  `,
});

It create on js file, then i call it on html file like:

<product-list :products="products" :maximum-price="maximumPrice"></product-list>

products value are object-array, maximumPrice are 25 (integer), price-card component in my product-list component just show the value of item.

What should i do for solve this?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

the prop definition should be written in camelCase format in the child component :

 props: ["products", "maximumPrice"],

and used with same format in your template :

 v-if="item.price <= Number(maximumPrice)"
about 4 years ago · Juan Pablo Isaza Relatório

0

Variables with dashes are invalid in js.

So when you are doing this: Number(maximum-price)

It's interpreted as Number(maximum 'minus' price).

That's why you have this error message: Property or method "maximum" is not defined on the instance but referenced during render. Because it's looking for a variable maximum and a variable price.

What you can do is change the naming to maximum_price for example.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda