textarea.uvue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <cl-page>
  3. <view class="p-3">
  4. <demo-item :label="t('基础用法')">
  5. <cl-textarea></cl-textarea>
  6. </demo-item>
  7. <demo-item :label="t('自定义')">
  8. <view class="mb-3">
  9. <cl-textarea
  10. v-model="content"
  11. :border="isBorder"
  12. :disabled="isDisabled"
  13. :show-word-limit="isShowCount"
  14. :auto-height="isAutoHeight"
  15. :pt="{
  16. className: parseClass({
  17. '!bg-sky-100': isColor,
  18. '!border-sky-700': isColor
  19. }),
  20. inner: {
  21. className: parseClass({
  22. '!text-sky-700': isColor
  23. })
  24. }
  25. }"
  26. ></cl-textarea>
  27. </view>
  28. <cl-list border>
  29. <cl-list-item :label="t('边框')">
  30. <cl-switch v-model="isBorder"></cl-switch>
  31. </cl-list-item>
  32. <cl-list-item :label="t('显示字数')">
  33. <cl-switch v-model="isShowCount"></cl-switch>
  34. </cl-list-item>
  35. <cl-list-item :label="t('自动增高')">
  36. <cl-switch v-model="isAutoHeight"></cl-switch>
  37. </cl-list-item>
  38. <cl-list-item :label="t('禁用')">
  39. <cl-switch v-model="isDisabled"></cl-switch>
  40. </cl-list-item>
  41. <cl-list-item :label="t('其他颜色')">
  42. <cl-switch v-model="isColor"></cl-switch>
  43. </cl-list-item>
  44. </cl-list>
  45. </demo-item>
  46. </view>
  47. </cl-page>
  48. </template>
  49. <script lang="ts" setup>
  50. import { ref } from "vue";
  51. import DemoItem from "../components/item.uvue";
  52. import { parseClass } from "@/cool";
  53. import { t } from "@/locale";
  54. const content = ref("Cool Unix");
  55. const isBorder = ref(true);
  56. const isShowCount = ref(true);
  57. const isDisabled = ref(false);
  58. const isColor = ref(false);
  59. const isAutoHeight = ref(false);
  60. </script>