Browse Source

perf: 关闭策略

pull/192/head
xiaojunnuo 3 years ago
parent
commit
ae06bcfc5f
  1. 4
      packages/core/src/config.js
  2. 4
      packages/gui/src/background.js
  3. 2
      packages/gui/src/bridge/on-close/front.js
  4. 2
      packages/gui/src/view/pages/setting.vue

4
packages/core/src/config.js

@ -172,6 +172,10 @@ const configApi = {
const config = configApi.get()
return config || {}
},
update (partConfig) {
const newConfig = lodash.merge(configApi.get(), partConfig)
configApi.save(newConfig)
},
get,
set (newConfig) {
if (newConfig == null) {

4
packages/gui/src/background.js

@ -186,6 +186,10 @@ function createWindow (startHideWindow) {
return
}
e.preventDefault()
if (isLinux()) {
quit(app)
return
}
const config = DevSidecar.api.config.get()
const closeStrategy = config.app.closeStrategy
if (closeStrategy === 0) {

2
packages/gui/src/bridge/on-close/front.js

@ -33,7 +33,7 @@ function install (app, api) {
async onOk () {
console.log('OK')
if (result.save) {
await api.config.save({ app: { closeStrategy: result.closeType } })
await api.config.update({ app: { closeStrategy: result.closeType } })
}
api.ipc.send('close', { key: 'selected', value: result.closeType })
},

2
packages/gui/src/view/pages/setting.vue

@ -35,7 +35,7 @@
<a-form-item label="远程配置地址" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-input v-model="config.app.remoteConfig.url"></a-input>
</a-form-item>
<a-form-item label="关闭策略" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-form-item v-if="!isLinux()" label="关闭策略" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-radio-group v-model="config.app.closeStrategy"
default-value="0" button-style="solid">
<a-radio-button :value="0">

Loading…
Cancel
Save