slider.uvue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <cl-page>
  3. <view class="p-3">
  4. <demo-item :label="t('基础用法')">
  5. <cl-slider v-model="num"></cl-slider>
  6. </demo-item>
  7. <demo-item :label="t('自定义')">
  8. <cl-slider
  9. v-model="num2"
  10. :disabled="isDisabled"
  11. :show-value="isShowValue"
  12. :block-size="isSize ? 26 : 20"
  13. :step="isStep ? 10 : 1"
  14. :max="isMax ? 50 : 100"
  15. ></cl-slider>
  16. <cl-list
  17. border
  18. :pt="{
  19. className: 'mt-3'
  20. }"
  21. >
  22. <cl-list-item :label="t('显示值')">
  23. <cl-switch v-model="isShowValue"></cl-switch>
  24. </cl-list-item>
  25. <cl-list-item :label="t('步长10')">
  26. <cl-switch v-model="isStep"></cl-switch>
  27. </cl-list-item>
  28. <cl-list-item :label="t('滑块大点')">
  29. <cl-switch v-model="isSize"></cl-switch>
  30. </cl-list-item>
  31. <cl-list-item :label="t('最大50')">
  32. <cl-switch v-model="isMax"></cl-switch>
  33. </cl-list-item>
  34. <cl-list-item :label="t('禁用')">
  35. <cl-switch v-model="isDisabled"></cl-switch>
  36. </cl-list-item>
  37. </cl-list>
  38. </demo-item>
  39. </view>
  40. </cl-page>
  41. </template>
  42. <script lang="ts" setup>
  43. import { ref } from "vue";
  44. import DemoItem from "../components/item.uvue";
  45. import { t } from "@/locale";
  46. const num = ref(60);
  47. const num2 = ref(35);
  48. const isDisabled = ref(false);
  49. const isShowValue = ref(true);
  50. const isStep = ref(false);
  51. const isSize = ref(false);
  52. const isMax = ref(false);
  53. </script>