textarea.uvue 1.6 KB

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