element-plus/docs/examples/form/alignment.vue
opengraphica 7173e402b7
feat(components): [form-item] auto attach labels to inputs (#7450)
* feat(components): [form-item] auto attach labels to inputs

* feat(components): [form-item] auto-attach up through select

* feat(components): [form-item] auto id complete for all inputs

* feat(components): [form-item] fix lint, remove unused usePopper hook

* feat(components): [form-item] PR comments
2022-05-05 22:04:32 +08:00

37 lines
963 B
Vue

<template>
<el-radio-group v-model="labelPosition" label="label position">
<el-radio-button label="left">Left</el-radio-button>
<el-radio-button label="right">Right</el-radio-button>
<el-radio-button label="top">Top</el-radio-button>
</el-radio-group>
<div style="margin: 20px" />
<el-form
:label-position="labelPosition"
label-width="100px"
:model="formLabelAlign"
style="max-width: 460px"
>
<el-form-item label="Name">
<el-input v-model="formLabelAlign.name" />
</el-form-item>
<el-form-item label="Activity zone">
<el-input v-model="formLabelAlign.region" />
</el-form-item>
<el-form-item label="Activity form">
<el-input v-model="formLabelAlign.type" />
</el-form-item>
</el-form>
</template>
<script lang="ts" setup>
import { reactive, ref } from 'vue'
const labelPosition = ref('right')
const formLabelAlign = reactive({
name: '',
region: '',
type: '',
})
</script>