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

562
Visualizações
vue.js: cannot acces public folder after incorporation of vue-router

I have a vue.js project where I play audio files that are stored in my public folder: enter image description here

Previously, I was able to access and play these files as such:

 path = 'recordings/Behar/weekday/1.mp3'
 this.audio = new Audio(path);
 this.audio.play()

But after adding the vue-router in main.js:

const routes = [
  { path: '/', component: Controller },
  { path: '/date/:date', component: Controller },
  { path: '/date/:date/aliyah/:aliyah', component: Controller },
  { path: '/date/:date/aliyah/:aliyah/verse/:verse', component: Controller },   
]

const router = new VueRouter({
  mode: 'history',
  routes // short for `routes: routes`
})

Vue.use(VueRouter)

Vue.config.productionTip = false

new Vue({
  router,
  vuetify,
  render: h => h(App)
}).$mount('#app')

When I try to play these recordings I see this message:

Uncaught (in promise) DOMException: Failed to load because no supported source was found.

I believe that somehow adding the vue-router has screwed up with my access to the public folder.

Why am I no longer able to access the public folder and how (and if at all) has vue-router changed that?

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

0

With the routing, I found that to access the publicPath I need to append a '/' in front of my path:

path = '/recordings/Behar/weekday/1.mp3'
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