搭配 Webpack 的 Quasar CLI - @quasar/app-webpack
我們將使用 Quasar CLI 來開發和建置行動應用程式。建置 SPA、PWA、Electron 應用程式或行動應用程式之間的差異僅由 “quasar dev” 和 “quasar build” 命令中的 “mode” 參數決定。
行動應用程式有兩個非常重要的設定檔。我們將逐一介紹。
capacitor.config.json
行動應用程式最重要的設定檔是 /src-capacitor/capacitor.config.json
。 /src-capacitor
資料夾是一個 Capacitor 專案,因此請參考 Capacitor 文件 以了解其中的每個檔案的作用。但現在,請花一些時間閱讀關於 capacitor.config.json 的資訊。
這個檔案中的某些屬性將會被覆寫,我們將在下一節中看到。
quasar.config 檔案
在 /quasar.config
檔案中有兩個地方可以設定 Capacitor 的 Quasar 特定功能。
return {
capacitor: {
// (Optional!)
hideSplashscreen: false, // disables auto-hiding the Splashscreen by Quasar CLI
// (Optional!)
capacitorCliPreparationParams: [ 'sync', ctx.targetName ],
// (Optional) If not present, will look for package.json > name
appName: '...', // string
// (Optional) If not present, will look for package.json > version
version: '...', // string
// (Optional) If not present, will look for package.json > description
description: '...', // string
}
}
content_paste
您也可以設定
return {
framework: {
config: {
capacitor: {
iosStatusBarPadding: true/false, // add the dynamic top padding on iOS mobile devices
}
}
}
}
content_paste
最後,您也可以停用或設定返回按鈕 hook (用於對話框)
return {
framework: {
config: {
capacitor: {
// Quasar handles app exit on mobile phone back button.
backButtonExit: true/false/'*'/['/login', '/home', '/my-page'],
// On the other hand, the following completely
// disables Quasar's back button management.
backButton: true/false
}
}
}
}
content_paste