简体   繁体   English

为什么我的 vue.app 没有出现在部署版本中?

[英]why my vue.app doesn't appear in the deploy version?

I want to deploy my vue.js project into the Github page.我想将我的 vue.js 项目部署到 Github 页面中。 It works well for HTML, CSS, image, but it didn't render the vue.它适用于 HTML、CSS、图像,但它没有渲染 vue。 app components.应用程序组件。 The part which shall render the vue.渲染 vue 的部分。 app disappear.应用消失。 Here is my dis folder structure.这是我的 dis 文件夹结构。 在此处输入图像描述

And here is my git repo: https://github.com/liulian1004/test .这是我的 git 仓库: https://github.com/liulian1004/test

Appreciate your help.感谢你的帮助。 I am a beginner for the Vue.js, and this is my first time to deploy the vue project.我是Vue.js的初学者,这是我第一次部署vue项目。 Let me know if you need more info.如果您需要更多信息,请告诉我。

Since you're not serving the app from the root directory, but in /test , you need to configure publicPath in vue.config.js :由于您不是从根目录提供应用程序,而是在/test中,因此您需要在vue.config.js 中配置 publicPath publicPath

module.exports = {
   publicPath: '/test/'
}

Here is a conditional publicPath using .env , from the Vue CLI docs which will allow you to serve it properly in both development and production:这是一个使用.env的条件publicPath ,来自Vue CLI 文档,它将允许您在开发和生产中正确地提供它:

module.exports = {
  publicPath: process.env.NODE_ENV === 'production'
    ? '/test/'
    : '/'
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM