tm-simple-btn-group.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <view class="tm-simple-btn-group">
  3. <button v-for="(item, index) in options"
  4. @click="changeStep(item.id)"
  5. :key="index">{{item.label}}</button>
  6. </view>
  7. </template>
  8. <script>
  9. /**
  10. * 底部组件,只有两个按钮的简单组件(只有文字没图标),按钮内容需要自行传入数据
  11. * props:{
  12. * options: [{id:按钮的唯一id,会在点击后返回,label:显示的文本内容}]
  13. * callback: 点击事件返回函数,返回参数是按钮id
  14. * }
  15. */
  16. export default {
  17. props: {
  18. options: {
  19. type: Array,
  20. default: [
  21. {id: 'pre', label: '上一步'},
  22. {id: 'next', label: '下一步'}
  23. ]
  24. }
  25. },
  26. methods: {
  27. changeStep: function(type) {
  28. this.$emit('callback', type);
  29. }
  30. }
  31. }
  32. </script>
  33. <style lang="less">
  34. .tm-simple-btn-group {
  35. position: fixed;
  36. bottom: 0;
  37. left: 0;
  38. display: flex;
  39. flex-direction: row;
  40. border-top: 0.62rpx solid #DADEE6;
  41. width: 100%;
  42. height: 75rpx;
  43. button {
  44. border-radius: 0;
  45. width: 50%;
  46. height: 100%;
  47. font-size: 22.5rpx;
  48. line-height: 75rpx;
  49. color: #3377FF;
  50. background-color: #fff;
  51. &:last-child {
  52. color: #fff;
  53. background-color: #3377FF;
  54. }
  55. &:after {
  56. border: 0;
  57. }
  58. }
  59. }
  60. </style>