feat(I18n): Add Ii8n
feat(LocaleDropdown): Add LocaleDropdown Component feat(store): Add localeStore
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import VFrom from './src/VForm.vue'
|
||||
import VFrom from './src/Form.vue'
|
||||
|
||||
export interface VFormExpose {
|
||||
count: number
|
||||
|
||||
@@ -20,7 +20,7 @@ export default defineComponent({
|
||||
props: {
|
||||
// 生成Form的布局结构数组
|
||||
schema: {
|
||||
type: Array as PropType<VFormSchema[]>,
|
||||
type: Array as PropType<FormSchema[]>,
|
||||
required: true,
|
||||
default: () => []
|
||||
},
|
||||
@@ -98,7 +98,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
// 渲染formItem
|
||||
function renderFormItem(item: VFormSchema) {
|
||||
function renderFormItem(item: FormSchema) {
|
||||
// 单独给只有options属性的组件做判断
|
||||
const notRenderOptions = ['SelectV2', 'Cascader', 'Transfer']
|
||||
const slotsMap: Recordable = {
|
||||
@@ -134,7 +134,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
// 渲染options
|
||||
function renderOptions(item: VFormSchema) {
|
||||
function renderOptions(item: FormSchema) {
|
||||
switch (item.component) {
|
||||
case 'Select':
|
||||
const { renderSelectOptions } = useRenderSelect(slots)
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
ElAutocomplete,
|
||||
ElDivider
|
||||
} from 'element-plus'
|
||||
import { VInputPassword } from '@/components/InputPassword'
|
||||
import { InputPassword } from '@/components/InputPassword'
|
||||
|
||||
const componentMap: Recordable<Component, ComponentName> = {
|
||||
Radio: ElRadioGroup,
|
||||
@@ -40,7 +40,7 @@ const componentMap: Recordable<Component, ComponentName> = {
|
||||
TimeSelect: ElTimeSelect,
|
||||
SelectV2: ElSelectV2,
|
||||
RadioButton: ElRadioGroup,
|
||||
InputPassword: VInputPassword
|
||||
InputPassword: InputPassword
|
||||
}
|
||||
|
||||
export { componentMap }
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ElCheckbox, ElCheckboxButton } from 'element-plus'
|
||||
import { defineComponent } from 'vue'
|
||||
|
||||
export function useRenderChcekbox() {
|
||||
function renderChcekboxOptions(item: VFormSchema) {
|
||||
function renderChcekboxOptions(item: FormSchema) {
|
||||
// 如果有别名,就取别名
|
||||
const labelAlias = item?.componentProps?.optionsAlias?.labelField
|
||||
const valueAlias = item?.componentProps?.optionsAlias?.valueField
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ElRadio, ElRadioButton } from 'element-plus'
|
||||
import { defineComponent } from 'vue'
|
||||
|
||||
export function useRenderRadio() {
|
||||
function renderRadioOptions(item: VFormSchema) {
|
||||
function renderRadioOptions(item: FormSchema) {
|
||||
// 如果有别名,就取别名
|
||||
const labelAlias = item?.componentProps?.optionsAlias?.labelField
|
||||
const valueAlias = item?.componentProps?.optionsAlias?.valueField
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Slots } from 'vue'
|
||||
|
||||
export function useRenderSelect(slots: Slots) {
|
||||
// 渲染 select options
|
||||
function renderSelectOptions(item: VFormSchema) {
|
||||
function renderSelectOptions(item: FormSchema) {
|
||||
// 如果有别名,就取别名
|
||||
const labelAlias = item?.componentProps?.optionsAlias?.labelField
|
||||
return item?.componentProps?.options?.map((option) => {
|
||||
@@ -25,7 +25,7 @@ export function useRenderSelect(slots: Slots) {
|
||||
}
|
||||
|
||||
// 渲染 select option item
|
||||
function renderSelectOptionItem(item: VFormSchema, option: ComponentOptions) {
|
||||
function renderSelectOptionItem(item: FormSchema, option: ComponentOptions) {
|
||||
// 如果有别名,就取别名
|
||||
const labelAlias = item?.componentProps?.optionsAlias?.labelField
|
||||
const valueAlias = item?.componentProps?.optionsAlias?.valueField
|
||||
|
||||
@@ -16,7 +16,7 @@ interface PlaceholderMoel {
|
||||
* @returns 返回提示信息对象
|
||||
* @description 用于自动设置placeholder
|
||||
*/
|
||||
export function setTextPlaceholder(schema: VFormSchema): PlaceholderMoel {
|
||||
export function setTextPlaceholder(schema: FormSchema): PlaceholderMoel {
|
||||
const textMap = ['Input', 'Autocomplete', 'InputNumber', 'InputPassword']
|
||||
const selectMap = ['Select', 'TimePicker', 'DatePicker', 'TimeSelect', 'TimeSelect']
|
||||
if (textMap.includes(schema?.component as string)) {
|
||||
@@ -74,7 +74,7 @@ export function setGridProp(col: ColProps = {}): ColProps {
|
||||
* @param item 传入的组件属性
|
||||
* @returns 默认添加 clearable 属性
|
||||
*/
|
||||
export function setComponentProps(item: VFormSchema): Recordable {
|
||||
export function setComponentProps(item: FormSchema): Recordable {
|
||||
const notNeedClearable = ['ColorPicker']
|
||||
const componentProps: Recordable = notNeedClearable.includes(item.component as string)
|
||||
? { ...item.componentProps }
|
||||
@@ -117,7 +117,7 @@ export function setItemComponentSlots(
|
||||
* @returns FormMoel
|
||||
* @description 生成对应的formModel
|
||||
*/
|
||||
export function initModel(schema: VFormSchema[], formModel: Recordable) {
|
||||
export function initModel(schema: FormSchema[], formModel: Recordable) {
|
||||
const model: Recordable = { ...formModel }
|
||||
schema.map((v) => {
|
||||
// 如果是hidden,就删除对应的值
|
||||
|
||||
Reference in New Issue
Block a user