Password
Password input
Markup Schema Example
<script lang="ts" setup>
import { createForm } from '@silver-formily/core'
import { FormItem, Password, Submit } from '@silver-formily/element-plus'
import { createSchemaField, FormProvider } from '@silver-formily/vue'
const form = createForm()
const { SchemaField, SchemaStringField } = createSchemaField({
components: {
FormItem,
Password,
},
})
function log(value: Record<string, any>) {
console.log(value)
}
</script>
<template>
<FormProvider :form="form">
<SchemaField>
<SchemaStringField
name="password"
title="Password Input"
x-decorator="FormItem"
x-component="Password"
/>
</SchemaField>
<Submit @submit="log">
Submit
</Submit>
</FormProvider>
</template>Password Input:
查看源码
JSON Schema Example
<script lang="ts" setup>
import { createForm } from '@silver-formily/core'
import { FormItem, Password, Submit } from '@silver-formily/element-plus'
import { createSchemaField, FormProvider } from '@silver-formily/vue'
const schema = {
type: 'object',
properties: {
password: {
'type': 'string',
'title': 'Password Input',
'x-decorator': 'FormItem',
'x-component': 'Password',
},
},
}
const form = createForm()
const { SchemaField } = createSchemaField({
components: {
FormItem,
Password,
},
})
async function onSubmit(value: Record<string, any>) {
console.log(value)
}
</script>
<template>
<FormProvider :form="form">
<SchemaField :schema="schema" />
<Submit @submit="onSubmit">
Submit
</Submit>
</FormProvider>
</template>Password Input:
查看源码
Template Example
<script lang="ts" setup>
import { createForm } from '@silver-formily/core'
import { FormItem, Password, Submit } from '@silver-formily/element-plus'
import { Field, FormProvider } from '@silver-formily/vue'
const form = createForm()
function log(value: Record<string, any>) {
console.log(value)
}
</script>
<template>
<FormProvider :form="form">
<Field
name="password"
title="Password Input"
:decorator="[FormItem]"
:component="[Password]"
/>
<Submit @submit="log">
Submit
</Submit>
</FormProvider>
</template>Password Input:
查看源码