<!-- 
  * 底部操作按钮
  * 可配合 组件一起使用
  * 也可以单独使用
-->
<template>
  <div class="button-bottom">
    <el-button @click="back"> {{ text }}</el-button>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'

const { go } = useRouter()

defineProps({
  text: {
    type: String,
    default: '返回'
  }
})
const emits = defineEmits(['handle-back'])

const back = () => {
  go(-1)
  emits('handle-back')
}
</script>

<style lang="less">
.button-bottom {
  width: 100%;
  background: #ffffff;
  border-top: 1px solid var(--el-border-color);
  // position: absolute;
  bottom: 0;
  left: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  z-index: 10;
  padding-top: 16px;
  margin-top: 16px;
}
</style>
