美文网首页Vue
Vue 创建项目

Vue 创建项目

作者: Rinaloving | 来源:发表于2023-02-25 11:07 被阅读0次

用 vite 创建 vue 项目

1. 打开 VScode , 通过命令创建项目

yarn create vite chat-site --template vue
QQ截图20230226110036.png

2. 启动项目

yarn install
yarn dev
QQ截图20230226110724.png

打包

1. 命令打包

yarn run build
QQ截图20230226130505.png

2. 打开打包好的文件

  • 浏览器打开


    QQ截图20230226130649.png
  • 空白页面


    QQ截图20230226130816.png
  • 在 vite.config.js 中 添加 base:'./'


    QQ截图20230226140754.png
  • 修改 src/index.html 文件 ./vite.svg 、 ./src/main.js


    QQ截图20230226140908.png
  • 重新打包,发布到 nginx 上即可看到效果(本地打开肯定空白)


    QQ截图20230226141245.png
  • 怎么部署 nginx 可以参考我其它日志

相关文章

网友评论

    本文标题:Vue 创建项目

    本文链接:https://www.haomeiwen.com/subject/loyfldtx.html