Btn.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <div class="btn1-bg">
  3. <div class="name-bottom" v-if="show">
  4. <div class="btn-left" @click="leftclick">{{lefttitle}}</div>
  5. <div class="btn-right" @click="rightclick">{{righttitle}}</div>
  6. <div class="clear"></div>
  7. </div>
  8. <div class="name-bottom1" v-if="!show">
  9. <div class="btn-title" @click="titleclick">{{title}}</div>
  10. </div>
  11. </div>
  12. </template>
  13. <script>
  14. export default {
  15. name: '',
  16. props: {
  17. lefttitle: {
  18. type: String,
  19. default: '取消',
  20. require: true
  21. },
  22. righttitle: {
  23. type: String,
  24. default: '确认',
  25. require: true
  26. },
  27. title: {
  28. type: String,
  29. default: '确认',
  30. require: true
  31. },
  32. show: {
  33. type: Boolean,
  34. default: false,
  35. require: true
  36. }
  37. },
  38. data () {
  39. return {
  40. }
  41. },
  42. components: {},
  43. computed: {},
  44. beforeMount () {},
  45. mounted () {},
  46. methods: {
  47. leftclick () {
  48. this.$emit('leftclick')
  49. },
  50. rightclick () {
  51. this.$emit('rightclick')
  52. },
  53. titleclick () {
  54. this.$emit('titleclick')
  55. }
  56. },
  57. watch: {}
  58. }
  59. </script>
  60. <style lang='less' scoped>
  61. .btn1-bg {
  62. .name-bottom {
  63. height: 1rem;
  64. background: #fff;
  65. position: fixed;
  66. bottom: 0;
  67. width: 100%;
  68. border-top: 0.02rem solid #ccc;
  69. z-index: 100;
  70. .btn-left {
  71. height: 0.6rem;
  72. border: 0.02rem solid #cccccc;
  73. font-size: 0.28rem;
  74. text-align: center;
  75. line-height: 0.6rem;
  76. border-radius: 0.3rem;
  77. float: left;
  78. color: #4c4c4c;
  79. width: 3.4rem;
  80. margin-top: 0.2rem;
  81. margin-left: 0.2rem;
  82. }
  83. .btn-right {
  84. height: 0.64rem;
  85. font-size: 0.28rem;
  86. text-align: center;
  87. line-height: 0.64rem;
  88. border-radius: 0.3rem;
  89. float: right;
  90. background:#28cd5e;
  91. color: #fff;
  92. width: 3.44rem;
  93. margin-top: 0.2rem;
  94. margin-right: 0.2rem;
  95. }
  96. }
  97. .name-bottom1 {
  98. height: 1rem;
  99. background: #fff;
  100. position: fixed;
  101. bottom: 0;
  102. width: 100%;
  103. z-index: 100;
  104. // border-top: 0.02rem solid #ccc;
  105. box-sizing: border-box;
  106. padding: 0.2rem 0.2rem;
  107. .btn-title {
  108. // height: 0.64rem;
  109. font-size: 0.28rem;
  110. text-align: center;
  111. line-height: 0.64rem;
  112. border-radius: 0.3rem;
  113. background: #28cd5e;
  114. color: #fff;
  115. width: 100%;
  116. }
  117. }
  118. }
  119. </style>