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

284
Visualizações
Vue 3 + Vee Validate file input validation

I'm trying to validate my file input (type image) but I got this error:

Uncaught (in promise) DOMException: Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename, which may only be programmatically set to the empty string.

Template:

  <q-btn
          color="primary"
          outline
          label="Upload Avatar"
          @click="fileInputRef && fileInputRef.click()"
        />
        <input
          ref="fileInputRef"
          type="file"
          name="file"
          class="hidden"
          :value="avatar"
          @change="
            avatar = $event.target.files.length
              ? $event.target.files[0]
              : undefined
          "
        />

Script:

    const { value: avatar } = useField('avatar');
    const fileInputRef = ref<HTMLInputElement>();

Note: when I check Vue developer tools, avatar property set and I have selected file in my code but that error will show on console.

about 4 years ago · Juan Pablo Isaza
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