所有文件都有了,这下可以运行调试
npm run serve
没有错误的话就可以运行
npm run build
等编译完成后就可以将项目根目录下的dist文件夹里面的内容全部拷贝到网站根目录(本例是tp/public/)下,目录结构如下:
public
├─ .htaccess //重定向vue页面,需要新建
├─ favicon.ico //网站logo
├─ index.html //Vue的入口文件
├─ robots.txt
├─api //这个文件夹内是Thinkphp的API相关文件
│ ├─ .htaccess //重定向api的
│ ├─ index.php //api的入口文件
│ ├─ robots.txt
│ └─ router.php
├─css //这个文件夹是Vue编译后的dist里复制过来的
│ ├─ app.e0bf3cc6.css
│ └─ chunk-vendors.2ac5db4b.css
├─fonts //这个文件夹是Vue编译后的dist里复制过来的
│ ├─ element-icons.535877f5.woff
│ └─ element-icons.732389de.ttf
└─js //这个文件夹是Vue编译后的dist里复制过来的
├─ app.b4d7f528.js
├─ app.b4d7f528.js.map
├─ chunk-vendors.c06b49aa.js
└─ chunk-vendors.c06b49aa.js.map
public/.htaccess 重定向文件内容:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.html [L]
</IfModule>
好了,现在访问你的网站了http://localhost/。
调试完毕后记得修改thinkphp的环境文件,关闭debug:
APP_DEBUG = false
[DATABASE]
DEBUG = false
欢迎大家留言交流学习。