diff --git a/packages/gui/src/background.js b/packages/gui/src/background.js
index a70f56fc..5ded6850 100644
--- a/packages/gui/src/background.js
+++ b/packages/gui/src/background.js
@@ -74,7 +74,7 @@ function createWindow () {
// Create the browser window.
win = new BrowserWindow({
width: 900,
- height: 700,
+ height: 750,
title: 'DevSidecar',
webPreferences: {
enableRemoteModule: true,
diff --git a/packages/gui/src/bridge/index.js b/packages/gui/src/bridge/index.js
index fae19b92..cbd0ec80 100644
--- a/packages/gui/src/bridge/index.js
+++ b/packages/gui/src/bridge/index.js
@@ -24,14 +24,18 @@ const localApi = {
*/
setting: {
load () {
- const settingPath = _getSettingPath()
+ const settingPath = _getSettingsPath()
+ if (!fs.existsSync(settingPath)) {
+ return {}
+ }
const file = fs.readFileSync(settingPath)
- const settings = JSON5.parse(file.toString())
- return settings || {}
+ const setting = JSON5.parse(file.toString())
+ console.log('read file,', file.toString(), setting)
+ return setting || {}
},
- save (settings = {}) {
- const settingPath = _getSettingPath()
- fs.writeFileSync(settingPath, JSON5.stringify(settings, null, 2))
+ save (setting = {}) {
+ const settingPath = _getSettingsPath()
+ fs.writeFileSync(settingPath, JSON5.stringify(setting, null, 2))
}
},
/**
@@ -98,7 +102,7 @@ function _deepFindFunction (list, parent, parentKey) {
}
}
-function _getSettingPath () {
+function _getSettingsPath () {
const dir = './config/'
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir)
diff --git a/packages/gui/src/main.js b/packages/gui/src/main.js
index e536112e..9f06657d 100644
--- a/packages/gui/src/main.js
+++ b/packages/gui/src/main.js
@@ -16,11 +16,10 @@ Vue.component(DsContainer)
const router = new VueRouter({
routes // (缩写) 相当于 routes: routes
})
-Vue.prototype.$global = {}
+
view.initApi().then(async (api) => {
- Vue.prototype.$api = api
// 初始化status
- await view.initPre(api)
+ await view.initPre(Vue, api)
const app = new Vue({
router,
render: h => h(App)
diff --git a/packages/gui/src/view/components/settings.vue b/packages/gui/src/view/components/settings.vue
index 5a5955b0..dd44fb6e 100644
--- a/packages/gui/src/view/components/settings.vue
+++ b/packages/gui/src/view/components/settings.vue
@@ -102,7 +102,7 @@ import vueJsonEditor from 'vue-json-editor'
import lodash from 'lodash'
import api from '../api'
export default {
- name: 'settings',
+ name: 'setting',
components: {
vueJsonEditor
},
diff --git a/packages/gui/src/view/components/setup-ca.vue b/packages/gui/src/view/components/setup-ca.vue
index 71d67158..8fccd76d 100644
--- a/packages/gui/src/view/components/setup-ca.vue
+++ b/packages/gui/src/view/components/setup-ca.vue
@@ -5,7 +5,7 @@
:visible="visible"
:after-visible-change="afterVisibleChange"
@close="onClose"
- width="650px"
+ width="660px"
height="100%"
:slots="{ title: 'title' }"
wrapClassName="json-wrapper"
@@ -14,6 +14,10 @@
{{title}}