uni-app打包公眾號,H5
1.下載HBuilderX 安裝跳過
2. 打開編譯器,點擊文件->點擊打開目錄
3. 找到CRMEB標準版的文件管理器默認路徑為:/view/uni-app/
4. 點擊發(fā)行—網(wǎng)站H5手機版進行打包
注:如果需要獨立部署,修改下圖紅框為后臺接口地址
打包時編輯器出現(xiàn):預(yù)編譯器錯誤:代碼使用了scss/sass語言,但未安裝相應(yīng)編譯器…
打開 工具—插件安裝—scss/sass編譯進行安裝
5. 打包好之后將如下路徑里面的 static文件夾和index.html文件移到public下
獨立部署
把h5端打包后的代碼不和php文件放在一起,稱為獨立部署,獨立部署需要配置偽靜態(tài)。不配置的話,訪問第一次沒有問題,刷新會出現(xiàn)404
NGINX配置
location / {
try_files $uri $uri/ /index.html;
}
APACHE
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>