tiny-vue/examples/sites/demos/pc/app/form/label-align-composition-api...

42 lines
1.2 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="demo-form">
<div class="title">标签文字对齐 <tiny-switch v-model="isLabelAlign"></tiny-switch></div>
<tiny-form ref="ruleFormRef" :model="createData" label-position="left" :label-align="isLabelAlign">
<tiny-form-item label="用户名" prop="username" required>
<tiny-input v-model="createData.username"></tiny-input>
</tiny-form-item>
<tiny-form-item label="密码" prop="password" required>
<tiny-input v-model="createData.password" type="password" show-password></tiny-input>
</tiny-form-item>
<tiny-form-item label="密钥" prop="password2">
<tiny-input v-model="createData.password2" type="password" show-password></tiny-input>
</tiny-form-item>
</tiny-form>
</div>
</template>
<script setup>
import { ref, reactive } from 'vue'
import { Form as TinyForm, FormItem as TinyFormItem, Input as TinyInput, Switch as TinySwitch } from '@opentiny/vue'
const ruleFormRef = ref()
const isLabelAlign = ref(true)
const createData = reactive({
username: '',
password: '',
password2: ''
})
</script>
<style scoped>
.demo-form {
width: 380px;
}
.title {
margin-bottom: 20px;
font-size: 14px;
}
</style>