Skip to content

Commit b324158

Browse files
committed
feat: support attrs in kebab-case, closes #84
1 parent 1740ef6 commit b324158

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

eslint.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export default antfu(
99
'brace-style': ['error', 'stroustrup', { allowSingleLine: false }],
1010
'curly': ['error', 'all'],
1111
'no-console': 'off',
12-
'vue/attribute-hyphenation': 'off',
1312
'vue/max-attributes-per-line': 'error',
1413
'vue/multi-word-component-names': 'off',
1514
'vue/no-deprecated-v-bind-sync': 'off',

src/Component.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@ export default defineComponent({
113113
},
114114
],
115115
{
116-
type: Object,
116+
camelizeObjectKeys: true,
117117
mergeFunction,
118+
type: Object,
118119
},
119120
)
120121

@@ -174,17 +175,18 @@ export default defineComponent({
174175
onChange?: (...args: any) => unknown
175176
onChangeMode?: (...args: any) => unknown
176177
} = {}
177-
if (newAttrs.onChange) {
178+
if (newAttrs.onChange || newAttrs['on-change']) {
178179
defaultFunctionAttrs.onChange = onChange
179180
}
180-
if (newAttrs.onChangeMode) {
181+
if (newAttrs.onChangeMode || newAttrs['on-change-mode']) {
181182
defaultFunctionAttrs.onChangeMode = onChangeMode
182183
}
183184
jsonEditor.value?.updateProps(
184185
Object.getOwnPropertyNames(defaultFunctionAttrs).length > 0
185186
? conclude([newAttrs, defaultFunctionAttrs], {
186-
type: Object,
187+
camelizeObjectKeys: true,
187188
mergeFunction,
189+
type: Object,
188190
})
189191
: newAttrs,
190192
)

0 commit comments

Comments
 (0)