tm-button.vue 966 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <template>
  2. <view
  3. :class="['tm-button-container', type === 'pramary' ? 'pramary' : '']"
  4. @click="btnClick" >
  5. <text class="btn-text">{{ btnText }}</text>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. props: {
  11. //按钮类型 default:蓝色背景按钮;pramary:线条按钮
  12. type: {
  13. type: String,
  14. default: 'default'
  15. },
  16. btnText: {
  17. type: String,
  18. default: '确定'
  19. }
  20. },
  21. methods: {
  22. btnClick() {
  23. this.$emit('btnClick')
  24. }
  25. }
  26. }
  27. </script>
  28. <style lang="less">
  29. .tm-button-container {
  30. display: flex;
  31. justify-content: center;
  32. align-items: center;
  33. width: 312.5rpx;
  34. height: 62.5rpx;
  35. background: #3377FF;
  36. border-radius: 37.5rpx;
  37. border: 1.25rpx solid #3377FF;
  38. .btn-text {
  39. font-size: 22.5rpx;
  40. letter-spacing: 2.5rpx;
  41. color: #fff;
  42. }
  43. }
  44. .tm-button-container.pramary {
  45. background-color: #FFFFFF;
  46. .btn-text {
  47. color: #3377FF;
  48. }
  49. }
  50. </style>