Skip to content

Commit

Permalink
perf: optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
cc-hearts committed Apr 4, 2024
1 parent ba317fd commit 837d2e7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
19 changes: 0 additions & 19 deletions packages/ant-design-vue/src/components/form-schema/form-schema.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,6 @@
v-model:value="formValue[item.name]"
v-bind="item.componentProperty"
/>
<!-- <template v-else-if="item.type === 'input'">
<a-input v-model:value="formValue[item.name]" :placeholder="'请输入' + item.label" v-bind="item.extra" />
</template>
<template v-else-if="item.type === 'input-number'">
<a-input-number class="w-full" v-model:value="formValue[item.name]" :placeholder="'请输入' + item.label"
v-bind="item.extra" />
</template>
<template v-else-if="item.type === 'select'">
<a-select v-model:value="formValue[item.name]" :placeholder="'请选择' + item.label" v-bind="item.extra"
:options="unref(item.extra?.options || [])">
</a-select>
</template>
<template v-else-if="item.type === 'radio'">
<a-radio-group v-model:value="formValue[item.name]" v-bind="item.extra">
<template v-for="l in item.options" :key="l.value">
<a-radio :value="l.value">{{ l.label }}</a-radio>
</template>
</a-radio-group>
</template> -->
</a-form-item>
</a-col>
</a-row>
Expand Down
6 changes: 4 additions & 2 deletions packages/ant-design-vue/src/components/form-schema/helper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const VERSION = '0.0.1'
import type { MaybeRef } from 'vue'

export const VERSION = '0.0.2'

interface Options {
label: string
Expand All @@ -14,7 +16,7 @@ export interface FormSchema {
span?: number
slot?: { name: string; [props: string]: any }
componentProperty?: {
options?: Options[]
options?: MaybeRef<Options[]>
[props: string]: any
}
}
Expand Down
3 changes: 3 additions & 0 deletions packages/ant-design-vue/src/components/form-schema/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ import { VERSION } from './helper.js'
withInstall(FormSchema, VERSION)

export { FormSchema }

export * from './helper'
export * from './utils/define-form-schema-props'
export * from './utils/create-set-fields-factory'

0 comments on commit 837d2e7

Please sign in to comment.