btn.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <div :class="customClass">
  3. <div v-if="placeholder && label"
  4. class="outside-label" />
  5. <q-btn :label="label"
  6. :color="color"
  7. :outline="outline"
  8. :class="btnClass"
  9. :disable="disable"
  10. :loading="loading"
  11. @click="onClick" />
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. name: 'BtnControl',
  17. props: {
  18. value: {
  19. default: () => [],
  20. type: [Array, String, Number, Boolean]
  21. },
  22. btnClass: {
  23. default: '',
  24. type: String
  25. },
  26. color: {
  27. default: 'primary',
  28. type: String
  29. },
  30. outline: {
  31. default: false,
  32. type: Boolean
  33. },
  34. label: {
  35. default: '',
  36. type: String
  37. },
  38. placeholder: {
  39. default: '',
  40. type: String
  41. },
  42. disable: {
  43. default: false,
  44. type: Boolean
  45. },
  46. loading: {
  47. default: false,
  48. type: Boolean
  49. },
  50. customClass: {
  51. default: '',
  52. type: String
  53. },
  54. atClick: {
  55. type: Function,
  56. default: () => {}
  57. }
  58. },
  59. data () {
  60. return {
  61. inputData: null
  62. }
  63. },
  64. created () {
  65. this.inputData = this.value
  66. },
  67. methods: {
  68. onClick (event) {
  69. this.atClick()
  70. this.$emit('onClick', event)
  71. }
  72. }
  73. }
  74. </script>
  75. <style lang="scss" scoped>
  76. .outside-label {
  77. height: 25px;
  78. }
  79. </style>