BackButton.vue 780 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <!--
  2. * 底部操作按钮
  3. * 可配合 组件一起使用
  4. * 也可以单独使用
  5. -->
  6. <template>
  7. <div class="button-bottom">
  8. <el-button @click="back"> {{ text }}</el-button>
  9. </div>
  10. </template>
  11. <script setup>
  12. import { useRouter } from 'vue-router'
  13. const { go } = useRouter()
  14. defineProps({
  15. text: {
  16. type: String,
  17. default: '返回'
  18. }
  19. })
  20. const emits = defineEmits(['handle-back'])
  21. const back = () => {
  22. go(-1)
  23. emits('handle-back')
  24. }
  25. </script>
  26. <style lang="less">
  27. .button-bottom {
  28. width: 100%;
  29. background: #ffffff;
  30. border-top: 1px solid var(--el-border-color);
  31. // position: absolute;
  32. bottom: 0;
  33. left: 0;
  34. display: flex;
  35. justify-content: flex-end;
  36. align-items: center;
  37. z-index: 10;
  38. padding-top: 16px;
  39. margin-top: 16px;
  40. }
  41. </style>