Programing

매개 변수를 사용하는 vue-properties가 netlify에서 배포를 실행할 수 없음

c10106 2022. 3. 16. 21:49
반응형

매개 변수를 사용하는 vue-properties가 netlify에서 배포를 실행할 수 없음

홈뷰

<template>
  <h3>Home</h3>
</template>

검정1.vue

<template>
  <h3>TEst page {{symbol}}</h3>
</template>

<script>
export default {
  data() {
      return {
        symbol: this.$route.params.id
      }
    },
}
</script>
export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/test/:id',
      component: Test1
    },
    {
      path: '/home',
      component: Home
    },
  ]
})

[netlifylink/test/1] 웹사이트를 통해 전화를 할 수 없다."Page Not Founded(페이지는 찾을 수 없음) 이 사이트에 없는 URL을 입력하거나 끊어진 링크를 따라간 것 같다"는 내용이다.

그래도 localhost:8080/test/1에 액세스할 수 있음

나는 localhost:8080/home에 전화하고 [netlifylink/home]은 직장이다. 왜?

제발 도와줘문법적으로 미안해.

Vue 설명서 배포 섹션에도 수록되어 있음

https://cli.vuejs.org/guide/deployment.html#netlify

다음을 사용하여 직접 적중률을 수신하려면history modeVue Router에서 당신은 "라는 파일을 만들어야 한다._redirects밑에/public다음 내용을 포함하여:

# Netlify settings for single-page application
/*    /index.html   200

Netlify에는 SPA를 위한 특별 배치 지침이 있다. 페이지: https://www.netlify.com/docs/redirects/ History PushstateSingle Page Apps 섹션으로 이동하면 다음 내용을 볼 수 있다.

단일 페이지 앱을 개발할 때 기록 푸시스테이트가 작동하여 깨끗한 URL을 얻으려면 다음 다시 쓰기 규칙을 실행하십시오.

/* /index.properties 200

이것은 브라우저가 어떤 URL을 요청하든 404를 제공하는 대신 효과적으로 index.html을 제공할 것이다.

이 내용을 에 추가해야 한다._redirects작성된 사이트의 루트 아래에 파일을 보관하십시오.

라는 파일을 만들다.netlify.toml프로젝트의 루트에 다음을 붙여넣으십시오.

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200

참조URL: https://stackoverflow.com/questions/56414707/vue-router-with-parameter-cant-run-deploy-on-netlify

반응형