Skip to content

Commit 44868db

Browse files
authored
Update Component.ts
1 parent 666c4ef commit 44868db

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/Component.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ export type Mode = 'tree' | 'text' | 'table'
2020

2121
const modelValueProp: any = isVue3 ? 'modelValue' : 'value'
2222
const updateModelValue: any = isVue3 ? 'update:modelValue' : 'input'
23-
24-
const boolAttributes = [
23+
const boolAttrs = [
2524
'mainMenuBar',
2625
'navigationBar',
2726
'statusBar',
@@ -39,10 +38,10 @@ export default defineComponent({
3938
mode: {
4039
type: String as PropType<Mode>,
4140
},
42-
...(Object.fromEntries(boolAttributes.map(boolAttr => [boolAttr, {
41+
...(Object.fromEntries(boolAttrs.map(boolAttr => [boolAttr, {
4342
type: Boolean as PropType<boolean>,
44-
default: false,
45-
}])) as { [key in typeof boolAttributes[number]]: { type: PropType<boolean>; default: boolean } }),
43+
default: undefined,
44+
}])) as { [key in typeof boolAttrs[number]]: { type: PropType<boolean>; default: undefined } }),
4645
},
4746
emits: [updateModelValue, 'update:mode'],
4847
setup(props, { attrs, emit, expose }) {
@@ -56,7 +55,7 @@ export default defineComponent({
5655
type: String as PropType<Mode>,
5756
})
5857
const initialValue = conclude([props[modelValueProp], globalProps[modelValueProp]])
59-
const initialBoolAttrs = Object.fromEntries(Array.from(boolAttributes, boolAttr =>
58+
const initialBoolAttrs = Object.fromEntries(Array.from(boolAttrs, boolAttr =>
6059
[boolAttr, conclude([props[boolAttr], globalProps[boolAttr]])])
6160
.filter(([, v]) => v !== undefined))
6261

@@ -119,9 +118,9 @@ export default defineComponent({
119118
})
120119
})
121120

122-
watch(() => Array.from(boolAttributes, boolAttr => props[boolAttr]), (values) => {
121+
watch(() => Array.from(boolAttrs, boolAttr => props[boolAttr]), (values) => {
123122
jsonEditor.value.updateProps(Object.fromEntries(Array.from(values, (v, i) =>
124-
[boolAttributes[i], v]).filter(([, v]) => v !== undefined)))
123+
[boolAttrs[i], v]).filter(([, v]) => v !== undefined)))
125124
})
126125

127126
watch(() => attrs, (newAttrs) => {

0 commit comments

Comments
 (0)