惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Last Week in AI
Last Week in AI
GbyAI
GbyAI
Apple Machine Learning Research
Apple Machine Learning Research
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
N
Netflix TechBlog - Medium
量子位
aimingoo的专栏
aimingoo的专栏
D
Docker
F
Fortinet All Blogs
T
Tailwind CSS Blog
V
V2EX
D
DataBreaches.Net
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
G
Google Developers Blog
罗磊的独立博客
MongoDB | Blog
MongoDB | Blog
Microsoft Security Blog
Microsoft Security Blog
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
A
About on SuperTechFans
IT之家
IT之家

博客园 - 代码小伙

gin框架使用zap,在日志中加入trace_id gorm使用gen自动生成模型和查询文件 Go使用base64Captcha生成字母验证码 GoFrame框架查询数据表时对字段取别名 GoFrame框架使用WherePri报错原因 GoFrame框架使用BindHandler设置路由失效的原因 GoFrame框架WebServer默认端口号是什么 GoFrame框架SetFileServerEnabled关闭静态服务不生效 vite修改端口号 用路由方式写一个通用的微信小程序校验文件验证 手机网页通过微信deeplink实现wap支付 position:sticky失效原因分析 mysql把一个表的字段赋值到另一张表 基于jquery的countdown插件实现毫秒倒计时 保姆级教程,centos7安装erlang和rabbitmq Element Plus表单resetFields重置表单无效 thinkphp6通过中间件设置跨域 centos7安装jdk vue3中使用swiper6实现轮播
Vue打包代码如何部署在ThinkPHP项目里
代码小伙 · 2021-12-01 · via 博客园 - 代码小伙

以下基于Vue3.X讲解,Vue2也类似

  • 修改src/router/index.js文件,将history模式改成hash模式
import { createRouter, createWebHashHistory } from 'vue-router'
const router = createRouter({
  history: createWebHashHistory(process.env.BASE_URL),
  routes
})
  • 项目根目录执行打包命令

    npm run build

  • 打包后得到dist目录,将里面的css、js、img文件夹和index.html文件直接复制到thinkphp的项目根目录,通常叫做public下面。

  • 访thinkphp项目的域名后面跟上index.html,可以访问到打包后的前端文件

    index.html可以改成其他名字,访问的时候也需要做相应改动