footer.uvue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <cl-page>
  3. <view class="p-3">
  4. <demo-item>
  5. <cl-text>解决底部按钮隐藏时页面底部仍有空白间距</cl-text>
  6. <cl-text>解决固定定位时内容占位缺失</cl-text>
  7. </demo-item>
  8. <cl-list>
  9. <cl-list-item :label="`${i}`" v-for="i in 50" :key="i"> </cl-list-item>
  10. </cl-list>
  11. </view>
  12. <cl-footer :vt="cache.key">
  13. <template v-if="status == 0">
  14. <view class="flex flex-row">
  15. <cl-button :pt="{ className: 'flex-1' }" text border size="large" @tap="cancel">
  16. {{ t("取消订单") }}
  17. </cl-button>
  18. <cl-button :pt="{ className: 'flex-1' }" type="primary" size="large" @tap="buy">
  19. {{ t("立即购买") }}
  20. </cl-button>
  21. </view>
  22. </template>
  23. <cl-button type="error" size="large" @tap="confirm" v-if="status == 1">
  24. {{ t("确认收货") }}
  25. </cl-button>
  26. <cl-button type="success" size="large" @tap="comment" v-if="status == 2">
  27. {{ t("评价") }}
  28. </cl-button>
  29. </cl-footer>
  30. </cl-page>
  31. </template>
  32. <script lang="ts" setup>
  33. import { useCache } from "@/cool";
  34. import { t } from "@/locale";
  35. import { ref } from "vue";
  36. import DemoItem from "../components/item.uvue";
  37. const status = ref(0);
  38. const { cache } = useCache(() => [status.value]);
  39. function cancel() {
  40. status.value = 3;
  41. }
  42. function buy() {
  43. status.value = 1;
  44. }
  45. function confirm() {
  46. status.value = 2;
  47. }
  48. function comment() {
  49. status.value = 3;
  50. }
  51. </script>