password.uvue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <view class="flex flex-col w-[80vw]">
  3. <cl-form-item prop="username" required :pt="{
  4. className: '!mb-4'
  5. }" :rules="[
  6. {
  7. required: true,
  8. message: '用户名不能为空'
  9. }
  10. ] as ClFormRule[]
  11. ">
  12. <cl-input clearable class="" :pt="{ className: '!h-[40px] !rounded-xxl !px-4 !w-[80vw]' }" v-model="form.username"
  13. placeholder="请输入用户名"></cl-input>
  14. </cl-form-item>
  15. <cl-form-item prop="password" required :pt="{
  16. className: '!mb-4'
  17. }" :rules="[
  18. {
  19. required: true,
  20. message: '密码不能为空'
  21. }, {
  22. min: 6,
  23. max: 12,
  24. message: '密码长度必须在6到16位之间'
  25. }
  26. ] as ClFormRule[]
  27. ">
  28. <cl-input :pt="{ className: '!h-[40px] !rounded-xxl !px-4 !w-[80vw]' }" clearable v-model="form.password" password
  29. placeholder="请输入密码">
  30. </cl-input>
  31. </cl-form-item>
  32. </view>
  33. </template>
  34. <script setup lang="ts">
  35. import { type PropType } from "vue";
  36. import type { LoginForm } from "./types";
  37. import { useRefs, } from "@/.cool";
  38. const props = defineProps({
  39. form: {
  40. type: Object as PropType<LoginForm>,
  41. default: () => ({})
  42. }
  43. });
  44. const emit = defineEmits(["success"]);
  45. const refs = useRefs();
  46. </script>